I have a module:
local M = {} M.starTable = {} M.displayObjectGroup = {} function addStarText() M.starTable.starText = display.newText({ ... }) M.displayObjectGroup[#M.displayObjectGroup + 1] = M.starTable.starText end return M
Later, I empty the displayObjectGroup:
for i = 1, #M.displayObjectGroup do M.displayObjectGroup[i]:removeSelf() M.displayObjectGroup[i] = nil end
I then test for nil:
if (M.starTable.starText ~= nil) then --- end
I would expect the value to be nil but it is not. The display object is not there but it still is not nil, kind of in a zombie state. Why?
How can I either set it to a “true nil” when emptying, or, how can I see if the display objects is there or not in an if-statement?