lua-users home
lua-l archive

Re: Is everything an expression?

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Sat, Sep 7, 2013 at 5:17 PM, Jerome Vuarand <jerome.vuarand@gmail.com> wrote:
> No.
It seems one of those feature requests that pop up occaisionally, see
http://lua-users.org/wiki/StatementsInExpressions
But about the if statement: the Lua Way is to write this so
local res = (a > 2) and x or y
which works because and/or return the matching value, not just a boolean.
(there is a problem if x were actually 'false')

AltStyle によって変換されたページ (->オリジナル) /