Inserting a table of display objects into a display group?

Can I just do group:insert(table) or do I need to iterate through each table object and add them individually?

I’m using a table of tables so something like this:

[lua]for y = 1, #sceneCells do
for x = 1, #sceneCells[1] do
group:insert(sceneCells[y][x])
end
end[/lua]

Thanks… [import]uid: 105707 topic_id: 29543 reply_id: 329543[/import]

The only thing you can insert into a group is a display object. A table is not a display object so cannot be inserted. So you would have to use a loop as you describe. Note that, in your example,
[lua]group[1]=sceneCells[1][1]
group[2]=sceneCells[1][2][/lua]
etc, so you have to refer to objects by a single index. (groups are 1-D lists)
[import]uid: 84768 topic_id: 29543 reply_id: 118627[/import]

@jfb - I appreciate the sanity check. I’m following you then that the group then in a sense is a table with each key containing one display object. This is really helpful for me to conceptualize and definitely explains why things started working better when I started iterating through my 2D table!

Thanks for the help :slight_smile: [import]uid: 105707 topic_id: 29543 reply_id: 118677[/import]