[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Bug with logical operator or misunderstanding?
- From: Enrico Colombini <erix@...>
- Date: Thu, 20 Jan 2011 16:52:22 +0100
On 20/01/2011 16.37, Thierry Van Elsuwe wrote:
Here is a small code where I've got an unexpected behavior
> (tried with Lua 5.1.4):
I get similar results with 5.1.2 (Windows):
print (1 and true)
--> true
print (1 and true or false)
--> true
print ((1 or 2) and true)
--> true
print ((1 or 2) and true or false)
--> 1
Maybe it's just afternoon drowsiness, but I'm a bit puzzled too. It's as
if the inner set of parenthesis were ignored and the last one is
interpreted as (1 or (2 and true) or false) due to precedence.
--
Enrico