View Single Post
01-14-18, 12:29 AM   #49
aallkkaa
A Warpwood Thunder Caller
 
aallkkaa's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2017
Posts: 98
Thanks for all your replies.

@ myrroddin
Very nice explanation ons single-threaded vs multi-threaded languages. That was pretty much what I thought, it's the "huge oversimplification, and is not 100% accurate" part I'm sure would loose me...

On the cons of upvalueing, again, nice explanation, and makes perfect sense. But I was a bit surprised that 8GB would give so little leeway, having WoW running (mostly) alnoe.
Seerah seems to have a different view on this, so...


@ aemiar
Those are very interesting points.
Regarding that little addon of mine (prints player coordinates and speed on BattlefieldMinimap), it's pretty much done. I actually picked it up as example fpr its simplicity. But thanks for the hint, it is a good coding principle, I think.
And you pretty much answered it in regards to my original question: upvalueing, in my case, where the globals are called only once per 0.25 seconds isn't worth it; might be if they were called every time OnUpdate was called (only to check how long since last call presently). But, as it is, no point.
Originally Posted by semlar View Post
Additionally, lua actually has an internal limit of 60 upvalues.
I preseume this is per addon ...?


@ Resike
Originally Posted by Resike View Post
I doubt upvaluing could cause this, since you are only creating a pointer to the same function that lives in a much smaller scope then the global one, nothing else.
And since both calls also goes up to another C function the time execute it would be a minuscule bit faster call, for the memory size of the function pointer.
On this I have a couple questions.
I thought it was (NOT actual code):
Lua Code:
  1. global function DoSomething()
  2. call C function;
  3. end
and then, doing local DoSomething = _G[DoSomething] would bassically do:

A)
Lua Code:
  1. local function DoSomething()
  2. call C function;
  3. end

or...
B)

Lua Code:
  1. local function DoSomething()
  2. _G[DoSomething]();
  3. end

Which way does it work like?
  Reply With Quote