Re:Lua: Good, bad, and ugly parts
by graue on Saturday March 09, 2013 @08:24PM
(#5350295)
Lua's behavior here is identical to Ruby's, where 0 is also a truthy value:
Many things about many programming languages are surprising to newcomers. However, the rule is very simple (in Lua): In a boolean context, every value besides nil and false is treated as though it were true. It is absolutely consistent. (a == b) is not a boolean context, or else 2 == 3 would be true.
[ Parent
| on HN ]
There are no comments on this comment yet.