Handling more than 60 up values in createscene function

Hi Guys,

We are creating a game which has more than 60 display objects in a single scene. We are declaring the ‘local’ variables outside createscene, and initializing them inside createscene.

The problem is, createscene function cannot take reference of more than 60 upvalues and ends up in error.

Is there any alternative to handle more than 60 variables in a single scene ? any best practices we are missing out on ?   

Thanks in advance

[lua] local var1, var 2, var3 … var 60

function scene:createScene( event )

local group = self.view

group:insert(var1)
group:insert(var2)
.
.
group:insert(var60)

end[/lua]

It’s not just the createScene function, but LUA in general.
You might want to use a table to hold to 60 variables, like
 

local vars = {}; function scene:createScene( event ) local group = self.view group:insert(vars[1]) group:insert(vars[2]) . . group:insert(vars[60]) end

Here’s another thread wherein spawning methodology is discussed. It might help with describing the best ways to spawn a large amount of objects:

http://forums.coronalabs.com/topic/42417-need-help-reloading-scenes/#entry224178

It’s not just the createScene function, but LUA in general.
You might want to use a table to hold to 60 variables, like
 

local vars = {}; function scene:createScene( event ) local group = self.view group:insert(vars[1]) group:insert(vars[2]) . . group:insert(vars[60]) end

Here’s another thread wherein spawning methodology is discussed. It might help with describing the best ways to spawn a large amount of objects:

http://forums.coronalabs.com/topic/42417-need-help-reloading-scenes/#entry224178