LibRockHook-1.0

From WowAce Wiki
Jump to: navigation, search

API Documentation

Note: This documentation is auto-generated. Please note that direct modifications may be overwritten on next autogenerate.

:AddHook(object , method , callback)

Arguments

object
type - (needs documentation)
method
type - (needs documentation)
callback
type - (needs documentation)


string or function

:AddScriptHook(frame , "script" [, callback])

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.

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.

Example

MyAddon:AddScriptHook(frame, "OnMouseDown", function(object, ...)
	-- do something
	return RockTest.hooks[object].OnMouseDown(...)
end)

:AddSecureHook(object , method , callback)

Arguments

object
type - (needs documentation)
method
type - (needs documentation)
callback
type - (needs documentation)


string or function

:AddSecureScriptHook(frame , "script" [, callback])

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.

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.

Example

MyAddon:AddSecureScriptHook(frame, "OnMouseDown", function(object, ...)
	-- do something
end)

:HasHook(object , "method")

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.

Returns

false or function or string - false if not hooked, or function/string for the callback.

Example

local hook = MyAddon:HasHook(frame, "OnMouseDown")

:RemoveAllHooks()

Notes

  • Unhooks all hooked functions, scripts, and methods.

Example

MyAddon:RemoveAllHooks()

:RemoveHook(object , "method")

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.

Notes

  • Unhooks a hooked function, script, or method

Example

MyAddon:RemoveHook("SomeGlobalFunction")
MyAddon:RemoveHook(frame, "OnMouseDown")