I have a table where objects are created and I want to run some logic stuff on the objects in order of how they were created, but I don’t even know how to Google what I want to do.
So basically I have a table like:
local table {}
numberOne[1] = “1.png”
numberTwo[2] = “1.png”
numberThree[3] = “1.png”
Then I randomly display the images with something like:
function getNumber()
local number = display.newImage(table[math.random(1,3)])
end
And I do this on a timer:
tmr = timer.performWithDelay(2000,getNumber,3)
What I’m hoping to do is use logic with the number, (I know this is wrong but I think it will help explain it), basically I want to do something like:
if (number = 3) then
number.isVisible = false
end
I want to run the logic on the numbers in the order they were created (oldest first). Like if the numbers two was the first number created, then run the ‘if statement’. I really don’t know how to make sure I’m not going to use the logic against all three items at once or the most recent one created. I’m not sure if I asked this right or even how to phrase what I want to do in Google. Any help would be much appreciated.