Refer to a variable dynamically

How can I refer to a variable dynamically? I want to create and use for example 10 images named img1, img2, …, img10 and then refer to them from inside a loop. [import]uid: 4416 topic_id: 4413 reply_id: 304413[/import]

don’t bother, create an array (table) with an index

[lua]local images = {}

function doStuff()

local img

for i=1, 10, 1 do

img = display.newImage(“ball.png”)

images[#images+1] = img

end

end[/lua]

doStuff()
images[3].rotation=45
[import]uid: 6645 topic_id: 4413 reply_id: 13772[/import]

Thank you. [import]uid: 4416 topic_id: 4413 reply_id: 13781[/import]