lua-users home
lua-l archive

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


On Mon, Dec 22, 2014 at 2:37 PM, Tom N Harris <telliamed@whoopdedo.org> wrote:
> Technically "if x==nil then y=x else y=x+1 end" is a single line. But I think
> you meant single expression.

Although, your point is a valuable one.

My experience is similar to the experience of Lua patterns (not LPeg)
or regex. That is, a very simple pattern is fine. Anything that gives
me pause A) probably has a bug B) requires re-discovering the problem,
solution, and many of the trials and errors in bridging the two, any
time that code needs to be touched.

And so, especially when "false/nil" is involved, a simple "if x ==
false then x = something end" can save a lot of head scratching.

FWIW

-Andrew