Ternary Expressions
Ternary expressions behave identical as to how they would in C. They introduce no new keywords.
Old Code
local max
if a > b then
max = a
else
max = b
end
New Code
local max = a > b ? a : b
Try It Yourself
Doesn't Lua already have ternaries?
While it is true that you can do something like this:
local max = a > b and a or b
Keep in mind that this falls apart when the true-expression has a falsy value:
local x = -1
x = (x == -1 and nil or x)
In this case, x will be -1 despite the intention being to set it to nil. There are no such issues using Pluto's ternary expressions.