Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Luau - Ternary operators not supported #82

Closed
RealEthanPlayzDev opened this issue Aug 30, 2022 · 6 comments
Closed

[BUG] Luau - Ternary operators not supported #82

RealEthanPlayzDev opened this issue Aug 30, 2022 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@RealEthanPlayzDev
Copy link

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

@RealEthanPlayzDev RealEthanPlayzDev added the bug Something isn't working label Aug 30, 2022
@levno-710
Copy link
Member

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

@levno-710 levno-710 self-assigned this Aug 30, 2022
@RealEthanPlayzDev
Copy link
Author

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
Copy link

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
Copy link
Author

RealEthanPlayzDev commented Sep 3, 2022

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
Copy link
Contributor

pnlmon commented Jan 12, 2023

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

@levno-710
Copy link
Member

related to #114

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants