[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Bitwise confusion?
- From: "Soni L." <fakedme@...>
- Date: Thu, 7 Jan 2016 17:44:27 -0200
On 07/01/16 05:35 PM, joec@infoark.com wrote:
I'm running LUA v5.3.2. In the code below shouldn't the following if
statements produce the same results?
-----code below here------
local tracemask = 0x00000040
local traceflgs = 0
val = traceflgs & tracemask
if (traceflgs & tracemask) then
print("val=" .. val .. "\n")
else
print("Branch not taken...\n")
end
if ((traceflgs & tracemask) > 0) then
print("val=" .. val .. "\n")
else
print("Branch not taken...\n")
end
if 0 then
print"0 is true"
else
print "0 is false"
end
if 0 > 0 then
print "0 > 0 is true"
else
print "0 > 0 is false"
end
http://www.lua.org/manual/5.3/manual.html#2.1
"Both nil and false make a condition false; any other value makes it true."
--
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.