Prometheus
Prometheus copied to clipboard
[BUG] Luau - Ternary operators not supported
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:
- Use the following test file
local x = if true then "yes" else "no"
- 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
I didn't even know these were a thing in LuaU
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
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
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
A lot of the new syntax are also not supported at the moment, for example: String interpolation and type annotations
related to #114