lua-users home
lua-l archive

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


I am somewhat at a loss understanding the following behavior of the shortcut
evaluation of the logical operators "and" and "or" in Lua 5.1.4.

The following works as expected:

> return 1 or 2
1

> return (1 or 2) and true
true

However, the following expression returns a result I do not expect:

> return (1 or 2) and true or false
1

I would expect this expression to return "true". What am I missing?