Thread Tools Display Modes
Prev Previous Post   Next Post Next
07-26-16, 05:06 PM   #1
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
Hooking a function used for OnUpdate.

Using the code below, the function called for OnUpdate won't get hooked using hooksecurefunc but will if you change it to HookScript.

hooksecurefunc will work for functions used for other scripts.

I don't believe this was the way it worked previously.

Lua Code:
  1. function SomeDopeyfunc(self)
  2. print("A")
  3. end
  4.  
  5. local f = CreateFrame("Frame", "SomeDopeyFrameName")
  6. f:SetSize(20, 20)
  7. f:SetScript("OnUpdate", SomeDopeyfunc)
  8.  
  9. local function SomeOtherfunc(self)
  10. print(self)
  11. end
  12.  
  13. --SomeDopeyFrameName:HookScript("OnUpdate", SomeOtherfunc)
  14. hooksecurefunc("SomeDopeyfunc", SomeOtherfunc)

Edit: Is this intended? Changing SomeDopeyfunc to a local function I get:
[code]
1x A\A.lua:16: hooksecurefunc(): SomeDopeyfunc is not a function
[C]: in function `hooksecurefunc'
A\A.lua:16: in main chunk

[code]
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 07-26-16 at 05:25 PM.
 
 

WoWInterface » Site Forums » Archived Beta Forums » Legion Beta archived threads » Hooking a function used for OnUpdate.


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