View Single Post
05-09-05, 09:33 AM   #2
Gello
A Molten Giant
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 521
Reference for Lua: http://www.lua.org/manual/5.0/ (Anything to do with file input/output and almost all os commands are disabled/inactive.)

correct form of that would be:
if temp ~= nil then
-- do stuff
end


or
if temp then
-- do stuff
end


In Lua, 0 is not nil. This took some getting used to for me. The above will be true for all of these: temp=true, temp=1, temp="a string", temp=0, temp={}, temp="".

The only cases when it wouldn't be true is: temp=false, temp=nil (meaning temp is not defined yet.)

Last edited by Gello : 05-09-05 at 09:37 AM.
  Reply With Quote