Table within a table

Can I do this?

myTable1 = {}

myTable2 = {}

myTable3 = {}

object1 = display.newImageRect(etc)

table.insert(myTable2, object1)

table.insert(myTable1, myTable2)

Basically I want to a bunch of objects to different tables so they can have different properties and functions, etc BUT I want to be able to access them from table 1 as well, just for general commands like moving x or y positions based on the position of the screen. Is this possible or is there any other way of going about this?

Thank you guys!

Yes, is the answer.  Though, there is probably a cleaner way to achieve what you’re after.

Cheers.

Sure, lua is flexible enough for this. But you may want to organize your table by using the hash part of lua tables:

myTable2.object = object1 myTable1.object\_container = myTable2

FYI: table.insert() inserts the object into the array part of the table.

Yes, is the answer.  Though, there is probably a cleaner way to achieve what you’re after.

Cheers.

Sure, lua is flexible enough for this. But you may want to organize your table by using the hash part of lua tables:

myTable2.object = object1 myTable1.object\_container = myTable2

FYI: table.insert() inserts the object into the array part of the table.