lua-users home
lua-l archive

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

On 02/28/13 08:04, Elias Barrionovo wrote:
On Thu, Feb 28, 2013 at 4:40 AM, Harley Laue <> 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")
That's exactly the type of caveat I wasn't sure if would come up. In retrospect, it does make sense considering the fact that they're logical operators.