lua-users home
lua-l archive

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


 

http://lua-users.org/wiki/ExpressionsTutorial

 

http://lua-users.org/wiki/TutorialDirectory

 

 

-----Original Message-----
From: Jim Bumgardner [mailto:[email protected]]
Sent: Thursday, October 02, 2003 10:47 PM
To: [email protected]
Subject: 0 ~= false

 

This one bit me a couple of days ago:

 

x = 0

.

.

.

if (x) then doSomethingObnoxious() end

 

 

Most of the languages I'm accustomed to would consider x to be false, which had

put me into the bad habit of occasionally using zero when I wanted false.  

 

Sadly, Lua doesn't consider zero to be false, so my program did something obnoxious.  :)

 

- Jim