Re:Lua: Good, bad, and ugly parts
by vor_ on Saturday March 09, 2013 @07:25PM
(#5350132)
Yes, because it's not just a C paradigm. Additionally, even though 1 is true, comparing 1 and true returns false!
[ Parent
| on HN ]
Re:Lua: Good, bad, and ugly parts
by Stratoscope on Saturday March 09, 2013 @07:58PM
(#5350215)
1 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.
I'm aware of the reasons why. It's still inconsistent to users. Remember that Lua is targeted at non-professional programmers.
Re:Lua: Good, bad, and ugly parts
by jmaygarden on Saturday March 09, 2013 @08:38PM
(#5350332)
In 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.