Prometheus icon indicating copy to clipboard operation
Prometheus copied to clipboard

[BUG] Luau - Ternary operators not supported

Open RadiatedExodus opened this issue 3 years ago • 4 comments

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"
  1. 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

RadiatedExodus avatar Aug 30 '22 13:08 RadiatedExodus

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

levno-710 avatar Aug 30 '22 13:08 levno-710

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

RadiatedExodus avatar Aug 30 '22 14:08 RadiatedExodus

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

LolloDev5123 avatar Sep 03 '22 09:09 LolloDev5123

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

RadiatedExodus avatar Sep 03 '22 13:09 RadiatedExodus

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

pnlmon avatar Jan 12 '23 13:01 pnlmon

related to #114

levno-710 avatar Feb 11 '23 21:02 levno-710