If example you want to position object 3 you would do:
[lua]objects[3].x = 123
objects[3].y = 234[/lua]
Many times it makes sense to make a table with all you objects properties before making them, you can copy paste this into main.lua:
[lua]
local objects = {}
local objectProperties = {
{x = 123, y = 234, name = “foo”, width = 100, height = 100}, – This is the first object
{x = 223, y = 134, name = “bar”, width = 50, height = 50} – This is the second object
}
local function objectTouchEvent(event)
print(event.target.name, “touched”)
end
– Start making objects
for i = 1,#objectProperties do
local name = objectProperties[i].name
local x, y = objectProperties[i].x, objectProperties[i].y
local width, height = objectProperties[i].width, objectProperties[i].height
objects[i] = display.newRect(x,y,width,height)
objects[i].name = name – A name that you could extract if object is touched for example
objects[i]:addEventListener( “tap”, objectTouchEvent )
end
[/lua]
This is a create tutorial: https://coronalabs.com/blog/2011/06/21/understanding-lua-tables-in-corona-sdk/