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.)