If a and t or f does not work for you, you can always just create a function:
function ternary ( cond , T , F ) if cond then return T else return F end end print("blah: " .. ternary(a == true ,"blah" ,"nahblah"))
of course, then you have a rollback that T and F are always evaluated .... to get around this, you need to provide the functions of your triple function, and this can become cumbersome:
function ternary ( cond , T , F , ...) if cond then return T(...) else return F(...) end end print("blah: " .. ternary(a == true ,function() return "blah" end ,function() return "nahblah" end))
daurnimator Apr 03 2018-11-11T00: 00Z
source share