So I’ve basically got a bunch of images in an existing group that I’m trying to move using a for loop. Group looks something like:
local group1 = display.newGroup()
local group1_1 = display.newImage( group1, symbol1 )
local group1_2 = display.newImage( group1, symbol2 )
local group1_2 = display.newImage( group1, symbol3 )
etc… etc…
I could move them each individually with:
symbol1_1.y = symboloffset
symbol1_2.y = symboloffset
symbol1_3.y = symboloffset
etc… etc…
BUT, I’m trying to do the same using a for loop instead since there’s quite a few. I’m not sure what the proper syntax is however?
I’ve been trying to reference these images with something like:
for count = 1, 30, 1 do
i = “group1_” … count
print(i)
[i].y = symboloffset
end
While printing “i” shows the value I’d expect in the console (group1_1, group1_2, up to group1_30), when I try to use that value to actually reference/move the images, the simulator dies and I get the following error:
…attempt to index global ‘i’ (a string value)
Can anyone point me in the right direction as to how I should reference existing objects within a for loop as such? Thanks!