-
Posted by protasm on Wed, 13 Apr 2011 13:07:53
Quick question today. Is this the proper way to "unhook" the OnUpdate() function:
frame:SetScript("OnUpdate", nil)
-
Posted by jnwhiteh on Thu, 14 Apr 2011 08:08:52
Well, there is no hook, which would have been done with HookScript() instead of SetScript(). You can use SetScript("OnUpdate", nil) to clear the currently set OnUpdate script, but you cannot ever 'unhook' a script that was set with HookScript(). So without a more precise question, it is difficult for me to say =)
-
Posted by protasm on Thu, 14 Apr 2011 18:55:40
Ok, I see. To be more specific, I had first done frame:SetScript("OnUpdate", foo).
Seems that SetScript would be preferable to HookScript for my purposes, since I only want to monitor OnUpdate intermittently, in response to user action.
-
Posted by jnwhiteh on Fri, 15 Apr 2011 07:16:23
Then yes, if it is a frame you control, you can use SetScript(). If you're using this on another frame (Blizzard's, for example) you should not. 'Disabling' your script in that case is slightly more work, but still possible.
In the simple case, what you have works perfectly!