lua-users home
lua-l archive

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


On Thu, 2011-01-20 at 10:37 -0500, Thierry Van Elsuwe wrote:
> local OneOrTwo = (1 or 2)
> local a = (OneOrTwo) and true or false
> local b = (1 or 2) and true or false
> local True = true
> local c = (1 or 2) and True or false

> print(a)
> print(b)
> print(c)

> The result is :

> true
> 1
> true

> I was expecting to get the following result:

> true
> true
> true
> 
> Is this a bug, or can someone can explain me why we have 1 instead of
> true?

I guess this is a known bug - http://www.lua.org/bugs.html#5.1.4-3 .