Prometheus
Prometheus copied to clipboard
Suggestion - Luau compatibility - Add Ternary Operators
I Suggest adding Ternary Operators support for the following reasons:
- It allows more compact, and efficient code.
- Code Styling becomes simpler
- Faster parsing and obfuscation time, since it is compact.
For example, Ternary operators in Luau:
local CurrentHour = tonumber(os.date("%H"))
local Name = "SpinnySpiwal"
local TimeWelcome = if CurrentHour <= 6 and CurrentHour <= 12 then
"Morning, " .. Name elseif CurrentHour >= 12 and CurrentHour <= 19 then
"Afternoon, " .. Name elseif CurrentHour >= 19 then
"Evening, " .. Name else "Error - Unknown Case"
print(TimeWelcome)
However, The above code snippet is much more compact compared to it's Lua 5.1 alternative:
local CurrentHour = tonumber(os.date("%H"))
local Name = "SpinnySpiwal"
local TimeWelcome
if CurrentHour >= 6 and CurrentHour <= 12 then
TimeWelcome = "Morning, " .. Name
elseif CurrentHour >= 12 and CurrentHour <= 19 then
TimeWelcome = "Afternoon, " .. Name
elseif CurrentHour >= 19 then
TimeWelcome = "Evening, " .. Name
end
print(TimeWelcome)
Thank you for taking the time to read through my suggestion.
Agreed. I think this is a good feature. It allows Prometheus to obfuscate more LuaU code.
Implementing this would require to rewrite some of the code.
The following files would definitely need to be modified: visitast.lua compiler.lua parser.lua
There may be more.
I currently don't have time to work on this, but I would accept a pull request if somebody wanted to work on this.