Predeclaring Variables and upvalue

Hi Folks!

I'm in a position where i need to predeclare 90 local images, these will control the level stars on the level select screen.

I added them by using
local Level1Stars

but it sent me an error saying the upvalue of that function is above 60.

After some research i discovered why i can't do this.

My question is, instead i am using a local table to contain my upvalues.

Can you tell me if this is right and safe?

Predeclaring images varaibles

1
2
3
local World1Stars = {
        World1Stars1, World1Stars2, World1Stars3...
        }

Yes, I think that is correct. The table will be local. And the fields in the table will only be accessible from your local table.

If the values of World1Stars1, World1Stars2, World1Stars3 (etc.) are not defined as local variables before the code posted from your predeclaration you are definitely using global variables to store your images within the function. Instead I think you want:

Predeclaration

1
local World1Stars = { }

Nathan is correct. Listen to Nathan. I wasn't paying close enough attention to the original code, just the concept.

views:1484 update:2011/12/1 20:56:45
corona forums © 2003-2011