LibRockHook-1.0
From WowAce Wiki
| Summary | |
|---|---|
| Lib: RockHook-1.0 | |
| Hooking library | |
| TOC | 2.4 (20400) |
| Category | Libraries |
| Author | ckknight |
| Details | |
| Links | |
| Website | http://www.wowace.com |
| Betas | Ace SVN Zip |
| Changelog | FishEye |
Contents
|
[edit]
API Documentation
Note: This documentation is auto-generated. Please note that direct modifications may be overwritten on next autogenerate.
[edit]
:AddHook(object , method , callback)
[edit]
Arguments
- object
- type - (needs documentation)
- method
- type - (needs documentation)
- callback
- type - (needs documentation)
string or function
[edit]
:AddScriptHook(frame , "script" [, callback])
[edit]
Arguments
- frame
- Frame - frame the script lives on.
- "script"
- string - the name of the script.
- callback
- string or function - the callback to call when the function is normally called.
[edit]
Notes
- hooks a frame's script, replacing it with your own function.
- this adds the original function to self.hooks[frame][script], which should be called in most cases.
[edit]
Example
MyAddon:AddScriptHook(frame, "OnMouseDown", function(object, ...) -- do something return RockTest.hooks[object].OnMouseDown(...) end)
[edit]
:AddSecureHook(object , method , callback)
[edit]
Arguments
- object
- type - (needs documentation)
- method
- type - (needs documentation)
- callback
- type - (needs documentation)
string or function
[edit]
:AddSecureScriptHook(frame , "script" [, callback])
[edit]
Arguments
- frame
- Frame - frame the script lives on.
- "script"
- string - the name of the script.
- callback
- string or function - the callback to call when the function is normally called.
[edit]
Notes
- hooks a frame's script, having your callback called after the original function
- This is primarily used for hooking secure scripts and maintaining the secure state.
[edit]
Example
MyAddon:AddSecureScriptHook(frame, "OnMouseDown", function(object, ...) -- do something end)
[edit]
:HasHook(object , "method")
[edit]
Arguments
- object
- table or Frame - table the method lives on or frame the script lives on. Optional, default: _G.
- "method"
- string - the name of the function, script, or method.
[edit]
Returns
false or function or string - false if not hooked, or function/string for the callback.
[edit]
Example
local hook = MyAddon:HasHook(frame, "OnMouseDown")
[edit]
:RemoveAllHooks()
[edit]
Notes
- Unhooks all hooked functions, scripts, and methods.
[edit]
Example
MyAddon:RemoveAllHooks()
[edit]
:RemoveHook(object , "method")
[edit]
Arguments
- object
- table or Frame - table the method lives on or frame the script lives on. Optional, default: _G.
- "method"
- string - the name of the function, script, or method.
[edit]
Notes
- Unhooks a hooked function, script, or method
[edit]
Example
MyAddon:RemoveHook("SomeGlobalFunction")
MyAddon:RemoveHook(frame, "OnMouseDown")

