prometheus-lua / Prometheus

Lua Obfuscator written in pure Lua
https://levno-710.gitbook.io/prometheus/
GNU Affero General Public License v3.0
205 stars 61 forks source link

[BUG] Luau - Ternary operators not supported #82

Closed RealEthanPlayzDev closed 1 year ago

RealEthanPlayzDev commented 1 year ago

Describe the bug It looks like ternary operators (x = if condition then true else false) aren't supported:

PROMETHEUS: Applying Obfuscation Pipeline to .\test.luau ...
PROMETHEUS: Parsing ...
PROMETHEUS: Parsing Error at Position 1:10, Unexpected Token "if". Expected a Expression!

Expected behavior Ternary operators for luau to be supported and not error.

To Reproduce Steps to reproduce the behavior:

  1. Use the following test file
    local x = if true then "yes" else "no"
  2. Input the file to Prometheus either via a lua script or cli

If your problem is a non-working obfuscated file, please also include a minimal source code example, your config file as well as the output file that you got.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here. Windows 11 x64, Lua 5,1

levno-710 commented 1 year ago

I didn't even know these were a thing in LuaU

RealEthanPlayzDev commented 1 year ago

I didn't even know these were a thing in LuaU

Well it's relatively new you can say, you can check https://luau-lang.org/syntax#if-then-else-expressions

LolloDev5123 commented 1 year ago

Some ternary operators don't use if and then Example:

local e = a and h or l -- If a is true, e is h, if a is false, e is l
RealEthanPlayzDev commented 1 year ago

Some ternary operators don't use if and then

Those ternary operators are already native lua, and is semi-ternary operator (it isn't technically), since if a was a true value but h was a false value it'll go to l anyways.

This report is about Luau actual ternary operators not being supported

pnlmon commented 1 year ago

A lot of the new syntax are also not supported at the moment, for example: String interpolation and type annotations

levno-710 commented 1 year ago

related to #114