So, here’s what I’m trying to do: I’ve got little images drawn on a map for level progression through our game, using circ.index and am expecting it behave like circ.x, circ.y where each object has it’s own index, but what i’m seeing is different. Within the for loop, it prints each index, as i expect it to, however whenever i click on circles, the print only provides the last index generated.
Where am I going wrong?
for i=1,#levelTable do -- print(i.. " " .. levelTable[i]["xCoord"].. "," .. levelTable[i]["yCoord"]) local xCoord, yCoord = levelTable[i]["xCoord"],levelTable[i]["yCoord"] local config = levelTable[i]["index"] -- local selection = --print( xCoord ..",".. yCoord ) circ = display.newImage( "img/character.png" ) circ:scale(.9,.9) circ.x = xCoord circ.y = yCoord+580 circ.index = config print( circ.index) -- circ.id = levelTable[i]["selection"] levelSelectors:insert( circ ) end