Lua basically already has ternary operators anyway since "and" and "or" short circuit. I also don't see the need of adding additional syntax for it.
local x = condition ? value_a : value b local x = condition and value_a or value_b
> The classic Lua idiom a and b or c has a pitfall when b is nil or false: then c is returned, even when a is truthy.
> E.g. true and false or 42 returns 42, whereas true ? false : 42 returns the (expected) false.
> The classic Lua idiom a and b or c has a pitfall when b is nil or false: then c is returned, even when a is truthy.
> E.g. true and false or 42 returns 42, whereas true ? false : 42 returns the (expected) false.