View Single Post
06-13-10, 04:59 PM   #12
Slakah
A Molten Giant
 
Slakah's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 863
Originally Posted by Grimsin View Post
local Party1CurrHealth, Party1MaxHealth = UnitHealth("Party1"), UnitHealthMax("Party1") --- does this count as two locals jammed into one? since im not actually using the word local again?
No you then have two upvalues.

blah that thread is only somewhat helpful.
That thread explains exactly whats going wrong.

Heres a quick example of the number of upvalues your using
lua Code:
  1. local local1, local2 = "blah", "blah"
  2. --At this point you have 2 upvalues
  3. do
  4.     local local3 = "blah"
  5.     --at this points there are 3 upvalues
  6. end
  7. --Now we're back to two again
  8.  
  9. local function func(arg1, arg2, arg3)
  10.     --When this function is called we have 5 upvalues
  11.     --here we only have access to local1, local2 and the args (arg1, arg2 and arg3)
  12. end
  13.  
  14. --Only two upvalues here local1 and local2
  15. func("blah", "blah", "blah")
  16. --Back to two upvalues again local1 and local2
  17.  
  18. mytable = {}
  19. --number of upvalues still at 2 because mytable is stored in the Global table _G
  20. mytable.var = "blah"
  21. --number of upvalues still at 2
This is the best example I can give of why it's breaking.

Now if at any point in your code the upvalue count reaches more than 60 then you'll get your error.
Ways to avoid this include separating your code into sensible blocks, or by storing more of your variables in tables.
  Reply With Quote