How to create an array of display groups?

Is there any way to create an array of display.groups?

I tried:

GamesCube = {}

local GamesCube[1] = display.newGroup()

But that doesn’t work.

I need to create 4 display groups with some elements in it, and be able to indentify them later by the number.

Of course I can do it the ugly way, like:

If x == 1 then

     GamesCube1 = display.newGroup()

elseif x == 2 then

     GamesCube2 = display.newGroup() 

end

But there has to be a smarter way to do this?

Anybody? 

You can’t localize a table “entry”. Take out the “local” and it should work as normal.

Thank you!

Just to be clear you can localize the table, just not the table entries:

local GamesCube = {}

GamesCube[1] = display.newGroup()

Rob

You can’t localize a table “entry”. Take out the “local” and it should work as normal.

Thank you!

Just to be clear you can localize the table, just not the table entries:

local GamesCube = {}

GamesCube[1] = display.newGroup()

Rob