This is personally my favourite Lua tutorial: http://lua-users.org/wiki/TablesTutorial
Thanks, but I was kind of hoping for something more closely related with Corona. This is Lua separate from Corona, but I will still look into it. Still need help with the above question though.
With tables though it doesn’t really vary between Corona SDK and barebones Lua, except for the fact that Corona SDK has a few extra table functions that are useful: https://docs.coronalabs.com/api/library/table/index.html. Not sure you’ll find anything more closely related to Corona SDK in terms of a tutorial on tables than what I posted above
Ok, thanks!
Never mind, I got it! (the second question earlier)
In case anyone has a similar problem: all I did was set the id for each rectangle to be -3 + i (which is their place in the table, in this case a max of 5), and then I set their x-coordinate to be the center of the screen plus the id multiplied by 75.
The end result:
A responsive set of 5 rectangles next to each other that will always appear in the center of the screen.
for i = 1, 5 do unitBox = display.newRect(i \* 75, 100, 50, 50) unitBox.id = -3 + i unitSet[i] = unitBox unitSet[i].x = centerX + unitBox.id \* 75 end