What does this error message mean?

Hi all,
Ever so often I get a compiler error message that looks like:
"function at line 465 has more than 60 upvalues"

It obviously has something to do with references but what? And can I increase the limit and/or should I?

Thanks,
-Dennis

I find it usually means you've missed an 'end' statement somewhere (or put one too many...)

take a look at this:
https://developer.anscamobile.com/forum/2011/04/24/error-more-60-upvalues#comment-38310

I mean, look at this ;)
http://wow.incgamers.com/forums/showpost.php?p=4140531&postcount=6

quote: "Basically, if your function makes too many references to variables that are not global, but which are defined outside the scope of the function - then it will fall over; I think the default value is 60."

-finefin

Thank you both. I've actually gotten the message by doing both things at various times. Missing end statement will do it. Also too many external local references.
One easy way to fix the second case which occurs I'm guessing with Lua newbies like me is to look at the following case.

My original code:

local var1 = 12
local var2 = {}
local var3 = "text"

So 3 external locals. This can be replaced by this.

local table = {}
table.var1 = 1
table.var2 = {}
table.var3 = "text"

So now it is one external local. It actually makes sense to "group" the variables according to function for clarity.
So perhaps you have a bunch of ui variables.

local ui = {}
ui.box = {}
ui.circle = {}

Hope this helps someone else new to Lua.
Thanks all,
-Dennis

views:1457 update:2011/12/28 9:26:54
corona forums © 2003-2011