[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Is everything an expression?
- From: steve donovan <steve.j.donovan@...>
- Date: Sat, 7 Sep 2013 19:06:58 +0200
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')