View Full Version : error : function has more than 60 upvalues
Kirika
10-06-2008, 03:21 PM
Hello,
first escuse me for my english, i'm french :)
I tried tu update arcanum mod adding the new portal and teleportation spell.
I don't know LUa but others languages.
The error is Interface\AddOns\Arcanum\Arcanum.lua:4822: function at line 3614 has more than 60 upvalues.
Anyone can help me ? What this error meaning ?
Thanks.
Kirika
Tunga
10-06-2008, 03:30 PM
What is line 3614?
Kirika
10-06-2008, 03:51 PM
What is line 3614?
it's function function Arcanum_CreateMenu(). I had 2 more button in the interface and add code in it.
Kirika
10-06-2008, 03:59 PM
it's function function Arcanum_CreateMenu(). I had 2 more button in the interface and add code in it.
Well, i think i found the problem. Just have to resolve it :)
Sorry for this post, I past more than 1h trying to find the probleme and after posting I find it :(
Seem i use to create more than one button at the same position. But i still don't know why i 'm this error message.
I will check it and come back here
Tunga
10-06-2008, 04:54 PM
Upvalues are something to do with nested functions, I'm not sure exactly what it means though.
Telic
01-07-2008, 08:18 PM
upvalues for dummies - (which includes me by the way)
In oversimplified terms you can categorise variables in to three different kinds :
Global
Local
&
Upvalue <- otherwise known as External Local Variable which is a much better name
var1 = 1;
local var2 = 2;
function smackMyValueUp()
local var3 = var1 + var2;
print( var3 );
return var3;
end
var1 is global
var3 is local
but
var2 is an external local variable when referenced within the function smackMyValueUp
i.e. var2 is an upvalue from the point of view of smackMyValueUp
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.
Memory storage of these types of variable have to be dealt with as special cases by LUA, as they are neither truly global, nor truly local to the function....
Tunga is correct in that nesting lots of functions inside each other can lead to the same problem, because all the local variables declared by the outer functions are available to be accessed by the inner most function, and are therefore upvalues.
If you want a proper explanation then check out the section on Closures in :
Programming in LUA : 6.1 - Closures (http://www.lua.org/pil/6.1.html)
Edit: function names are variables like any other
Tunga
01-07-2008, 10:48 PM
Ah that makes sense, great description :) .
From a technical point of view (I didn't actually check the link yet) I'm guessing this is due to having to pass those variables via a call stack or similar.
Telic
02-07-2008, 11:19 PM
Ah that makes sense, great description :) .
From a technical point of view (I didn't actually check the link yet) I'm guessing this is due to having to pass those variables via a call stack or similar.
Yup, I think it uses pseudo-indices to point at values that aren't on the stack or something...
But as I mentioned, my explanation really was gross over simplification, and the functionality enabled by Closures is the real reason that upvalues are handled that way, so the link above is worth looking at :ponder:
Tunga
02-07-2008, 11:42 PM
I found time to read it, that page makes a lot of sense and is good for understanding a bit about how Lua is really working behind the scenes. Great link, thanks :) .
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.