4 ms·
Yes, because it's not just a C paradigm. Additionally, even though 1 is true, comparing 1 and true returns false!
by vor_ 14y ago
Yes, because it's not just a C paradigm. Additionally, even though 1 is true, comparing 1 and true returns false!
- Stratoscope 14y ago1 is not the same value as true. Just as in the case I commented on a couple of messages above, 1 and true are two different types. The == operator does not compare the "truthiness" of two values. It compares the values, and if those values are two different types, they are always unequal. http://www.lua.org/pil/3.2.html http://www.lua.org/pil/3.2.html
- vor_ 14y agoI'm aware of the reasons why. It's still inconsistent to users. Remember that Lua is targeted at non-professional programmers.
- jmaygarden 14y agoIn my opinion, having (1==true) evaluated to true, but (2==true) evaluate to false is more inconsistent. Even non-professionals should follow logic if they are going to program.