View Single Post
04-18-09, 01:27 AM   #29
Azul
Banned
 
Azul's Avatar
Join Date: Apr 2009
Posts: 19
Originally Posted by yssaril View Post
why not declare your upvalues outside of the OnUpdate so that you don't have to mess with the locals inside of it

Code:
local frame=CreateFrame("Frame")
local foo,bar,text
frame:SetScript("OnUpdate",function(self)
	if not foo then 
		foo,bar,text="foo","bar",""
	end
	text=foo..bar
end)
this way you dont mess with globals and you retain the info between onupdates

also 60 upvalues is a tonne can you post your code and maybe we can find a better solution all together?
Because for some reason (or maybe no reason at all?) WoW's addon parser falls over and dies if there are over 60, and I can't find any way around this.

I need over 60 because I have over 60 variable values that are used. Some of them only vary between nil or 1, but I can't find any practical (not horribly slow) way to do bitwise operations so they need to each have a variable.


Originally Posted by Wimpface View Post
What about creating the variables outside the OnUpdate function and then change the values?

As such:
Code:
local var
local foo
local crap
frame:SetScript('OnUpdate', function()
var = "var"
foo = "foo"
crap = "crap"
	if dostuff then
		dostuff
	end
end)
It's what i did when i had performance issues and it helped loads, this is obviously not a working function and you would have to tweak it to your liking.
I'm nowhere near the others in terms of knowledge of LUA though, so this might not be the optimal solution.

EDIT: This also solves the issue where a global foo is not found.
That's what I tried to do, and wasn't able to, and thus why I made this topic. WoW has a seizure when there are over 60 of those variables.