In said post, I asked about Nil vs False, and decided to make air a nil value (in my table) to save memory. I did this without any problems.
Unfortunately, I am not able to check if a certain value from my table is nil or not! I have tried the following bits of code, and can't get them to work.
Code: Select all
if level[y][x] ~= nil then
Code: Select all
if not level[y][x] == nil then
Code: Select all
item = level[y][x]
if item ~= nil then
Code: Select all
item = level[y][x]
if not item == nil then
If anyone can give me code or tell my where I might find code that could help me, I would be very grateful.
Thank you very much
--Luska72
PS: I was able to check if a variable is Nil without problems, so I think Lua works like this:
Code: Select all
If VARIABLE == NIL
Code: Select all
If TABLE[Y][X] == NIL
However, the program crashes when grabbing the value from the table, so we can't compare to nil...