Insert a table in to a group

Hi everyone, I have a problem with tables and groups in Corona sdk. 

I know you can not insert a table within a group using group: insert (table), but there must be something I can do. 

What I need is to remove a group of images from a table when scene change … the images stay on the screen.

So, this is my table:

logoNames = {} logoNames[1].img = { "photo1.png", "photo2.png" } logoNames[2].img = { "photo3.png", "photo4.png" }

Then i’m using a SlideView to show the images: 

display.setStatusBar(display.HiddenStatusBar) local slideView = require("Zunware\_SlideView") local topImages = { "1", "2", } topImages = logoNames[cNum].img --imagesGroup:insert(topImages) -- This isn't working  

And when you press a button, a whole group swipe out:

transition.to(imagesGroup, { delay = 400, time = 300, y = 600 })

Is there any way to put the images from topImages in the imagesGroup?

**imagesGroup is already exists and is a display.newGroup

**I found this topic that is very similar to my problem, but it doesn’t help me

http://forums.coronalabs.com/topic/42602-how-to-use-insert/

Thank you very much!

If you just want to be able toread the file names somewhere else you can just add a reference to it on the group like:

imagesGroup.myTopImages = topImages

Then you can read that table anywhere you can access that group.

If you want the images actualy displayed then you need to use display.newImage or display.newImageRect for every image to create an image display object first and then you can insert that in the group.

If you just want to be able toread the file names somewhere else you can just add a reference to it on the group like:

imagesGroup.myTopImages = topImages

Then you can read that table anywhere you can access that group.

If you want the images actualy displayed then you need to use display.newImage or display.newImageRect for every image to create an image display object first and then you can insert that in the group.

Instead of waste forum space starting a new question, Im going to ask here because my question is very similar.

I also understand a table cannot be put into a group. However, Is it possible to insert a table into a container? I want to be able to treat a table as “one” display object. Nesting would be a good concept to think of concerning my question. I want several display objects to be treated as one…Possible? Thanks for any help! :slight_smile:

We need to define the terms you are using.

A table in Corona/Lua is a data structure for storing data and references, it has no visible component unless you are reffering to the tableView widget.

A display group is I way of grouping several display objects (images, texts, shapes) so you can move/size/manipulate them all together.

A container is a special kind of display group that has a mask to crop (not show) any display objects (or parts of them) in it that are outside of its bounds.

By this terms inserting a table in to a group or container makes no sense as I don’t know what you are trying to achieve.

If your table is basicaly a list of display objects then you can insert all of them separately in either a group or a container and manipulate them all together using the group or container. Remember you have to insert each one of them.

myTable = {} – Create a table for maintaining references

myGroup = display.newGroup() – Create a display group into which display objects will be inserted to manipulate them jointly

myImg = display.newImage(“someImage.png”) – create image

myTable[1] = myImg – insert a reference for later use in to the table could be also myTable:insert(myImg)

myGroup:insert(myImg) – insert the image (visualy) in to the display group

hope this clears it up

Instead of waste forum space starting a new question, Im going to ask here because my question is very similar.

I also understand a table cannot be put into a group. However, Is it possible to insert a table into a container? I want to be able to treat a table as “one” display object. Nesting would be a good concept to think of concerning my question. I want several display objects to be treated as one…Possible? Thanks for any help! :slight_smile:

We need to define the terms you are using.

A table in Corona/Lua is a data structure for storing data and references, it has no visible component unless you are reffering to the tableView widget.

A display group is I way of grouping several display objects (images, texts, shapes) so you can move/size/manipulate them all together.

A container is a special kind of display group that has a mask to crop (not show) any display objects (or parts of them) in it that are outside of its bounds.

By this terms inserting a table in to a group or container makes no sense as I don’t know what you are trying to achieve.

If your table is basicaly a list of display objects then you can insert all of them separately in either a group or a container and manipulate them all together using the group or container. Remember you have to insert each one of them.

myTable = {} – Create a table for maintaining references

myGroup = display.newGroup() – Create a display group into which display objects will be inserted to manipulate them jointly

myImg = display.newImage(“someImage.png”) – create image

myTable[1] = myImg – insert a reference for later use in to the table could be also myTable:insert(myImg)

myGroup:insert(myImg) – insert the image (visualy) in to the display group

hope this clears it up