Hi guys, I need some help with the following code. What I need to happen is each object to move over when its timer completes. However, the only object that ever moves is the most recently created one.
[lua]
objectTable = {}
function moveObject(tempObject)
tempObject.x = tempObject.x + 100
end
function createWall(_x, _y)
id = #objectTable + 1
objectTable[id] = display.newImage(“IMAGE.png”)
--Image Properties and Physics Properties and Whatever else
objectTable[id].timer = timer.performWithDelay(1000, function() moveObject (objectTable[id]) end,1)
end
createWall(100,1000)
createWall(100,1200)
createWall(100,1400)
[/lua]
I assume this is because “objectTable[id]” been changed. Does anyone know how to properly reference an object in a table when a timer completes. Thanks!!!