Thread Tools Display Modes
04-18-09, 02:13 AM   #41
Azul
Banned
 
Azul's Avatar
Join Date: Apr 2009
Posts: 19
Unhappy

Forget it. I was hoping somebody could just give me a straight answer to my question. I don't want to waste any more time on this, since all anyone is doing is trying to avoid the question. I'll just find a way to patch the lua module in WoW. Change the 60 to 255 or something. Bye.
 
04-18-09, 02:16 AM   #42
yssaril
A Warpwood Thunder Caller
 
yssaril's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2007
Posts: 96
straight answer: there is no way to have more than 60 upvalues

there is no way around this FACT

also at this point we can not help you except to look at your code and try to help you improve it
 
04-18-09, 02:16 AM   #43
Kemayo
A Cyclonian
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 41
I agree with the "you're doing something wrong in an OnUpdate if you need that many variables" consensus.

That said, if you insist on doing it, this would work:

Code:
local timeit = function(f, n)
    local start = os.clock()
    for i=0, n do
        f()
    end 
    print("Ran "..n.." times in "..(os.clock() - start).." seconds")
end

local store = {}
local function wipe(t)
    for k,v in pairs(t) do
        t[k] = nil
    end 
end
local function pack(t, ...)
    wipe(store)
    for i=1, select('#', ...) do
        table.insert(t, (select(i, ...)))
    end 
end
function Foo_OnUpdate_A()
    local a, b, c, d, e = unpack(store)
    if not a then
        a, b, c, d, e = 1, 2, 3, 4, 5
    end 
    -- do stuff
    pack(store, a, b, c, d, e)
end

timeit(Foo_OnUpdate_A, 100000) -- prints "Ran 100000 times in 0.54 seconds" on my computer...
The overhead from using tables is not large. I included the cute benchmarker to demonstrate that.

(And the code presented is less efficient than in-WoW code would be, because it could use the presumably optimized built-in wipe function instead of the one I wrote there.)

EDIT: To be fair, I increased the number of variables being stored. With 26 variables, it runs 100,000 times in 2.26 seconds.

Last edited by Kemayo : 04-18-09 at 02:22 AM.
 
04-18-09, 02:57 AM   #44
Shirik
Blasphemer!
Premium Member
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2007
Posts: 818
Just to be nit-picky, I should point out here that you're timing it by running n+1 times, not n times
__________________
たしかにひとつのじだいがおわるのお
ぼくはこのめでみたよ
だけどつぎがじぶんおばんだってことわ
しりたくなかったんだ
It's my turn next.

Shakespeare liked regexes too!
/(bb|[^b]{2})/
 
04-18-09, 03:00 AM   #45
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Somehow this feels very related now:
 
04-18-09, 06:10 AM   #46
Sythalin
Curse staff
 
Sythalin's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 680
Originally Posted by Azul View Post
Forget it. I was hoping somebody could just give me a straight answer to my question. I don't want to waste any more time on this, since all anyone is doing is trying to avoid the question. I'll just find a way to patch the lua module in WoW. Change the 60 to 255 or something. Bye.
The "straight answer" has been given several times now mate. All we've been trying to do is help you find an alternative, which you've made clear you have no interest in. So again, good luck on your project. By the sounds of it, you're going to need it.
 
04-18-09, 08:52 AM   #47
Nuckin
is laughing at you
 
Nuckin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 58
Originally Posted by Azul View Post
Forget it. I was hoping somebody could just give me a straight answer to my question. I don't want to waste any more time on this, since all anyone is doing is trying to avoid the question. I'll just find a way to patch the lua module in WoW. Change the 60 to 255 or something. Bye.
As I said before, you're having a scoping issue, and I was not implying malicious intent, but rather the limit is there to prevent people from doing what you're so adamant about doing.

Good Luck patch WoW, you'll probably get unauthenticated from the servers and your account banned.

Code:
function OnUpdate(self)
   local foo = "OVER NINE THOUSAND";
   doThis(self, foo);
   doThat(self, foo);

   local hello = false;
   if hello then
      doThisNow(self, foo);
   else
      doThatNow(self, foo);
   end
end
(the semicolons are out of habit)
__________________
SELECT * FROM users WHERE clue > 0;
0 rows returned.
 
04-18-09, 04:48 PM   #48
Kemayo
A Cyclonian
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 41
Originally Posted by Shirik View Post
Just to be nit-picky, I should point out here that you're timing it by running n+1 times, not n times
I WILL CUT YOU.
 
04-21-09, 09:36 AM   #49
Aesir
An Aku'mai Servant
 
Aesir's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 30
The website in his profile hosts a 3.09 private realm. How much assistance do you wish to provide?

[edit: Actually, let me rephrase: He, specifically, runs a private server.]
__________________
-- ęsir

Last edited by Aesir : 04-21-09 at 09:40 AM. Reason: Just wanted to be clear.
 
04-21-09, 09:48 AM   #50
Shirik
Blasphemer!
Premium Member
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2007
Posts: 818
In light of recent information I'm closing this thread as it is no longer useful since the OP is no longer with us.
__________________
たしかにひとつのじだいがおわるのお
ぼくはこのめでみたよ
だけどつぎがじぶんおばんだってことわ
しりたくなかったんだ
It's my turn next.

Shakespeare liked regexes too!
/(bb|[^b]{2})/
 

WoWInterface » Developer Discussions » Lua/XML Help » function "has more then 60 upvalues"

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off