lua-users home
lua-l archive

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


On Thu, Feb 28, 2013 at 4:40 AM, Harley Laue <losinggeneration@gmail.com> wrote:
> (...)
> int x = a ? b : c;
>(...)
> The same basic thing can be done in Lua as well:
> (...)

Just a quick note, these things are not actually equal, there's
actually a caveat [1] that sometimes comes to haunt me while I sleep.

compare this in C:
  printf("%dn\", 1 ? 0 : 1);

to this in Lua:
  print(true and false or "I'll haunt you while you sleep")

But please, let us not ressurect the Beast [2].

[1] http://www.lua.org/pil/3.3.html
[2] http://lua-users.org/cgi-bin/namazu.cgi?query=ternary&idxname=lua-l&max=10&result=normal&sort=score

-- 
NI!