Thread Tools Display Modes
Prev Previous Post   Next Post Next
12-19-19, 02:52 PM   #1
LudiusMaximus
A Rage Talon Dragon Guard
 
LudiusMaximus's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 320
hooksecurefunc() with local versions of functions?

I understood that it is considered a good habbit to declare local versions of global functions to make your code use less CPU cycles.
(See e.g. https://www.wowinterface.com/forums/...ad.php?t=57151)

So I am particularly doing

Code:
local SetCVar = _G.SetCVar
because my program uses SetCVar() a lot.

But how can I now hook a function to SetCVar()?
For _G.SetCVar I would have used:

Code:
hooksecurefunc("SetCVar", MyPostSetCVar)
But this does apparently not have the desired effect, because it only hooks to _G.SetCVar
whereas my code uses the local SetCVar.

Do I need hooksecurefunc() at all to hook to my local SetCVar?
Or what would the first argument of hooksecurefunc() have to be for a local function?

Thanks!
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » hooksecurefunc() with local versions of functions?


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