Navigation menu

WoW:Hooking functions: Difference between revisions

Jump to navigation Jump to search
→‎Hooking a function: bullet does not belong under this section
(→‎Hooking a function: bullet does not belong under this section)
Line 64: Line 64:


The example used the vararg expression to make sure that, should the API change, the hook will still pass exactly the arguments it was given (no more, no less) to the original function. An additional sanity check on the type of the link argument in 3 prevents a potential error: if the function was not passed a string as expected (for example, by another addon), we do not want to block the default behavior.
The example used the vararg expression to make sure that, should the API change, the hook will still pass exactly the arguments it was given (no more, no less) to the original function. An additional sanity check on the type of the link argument in 3 prevents a potential error: if the function was not passed a string as expected (for example, by another addon), we do not want to block the default behavior.
* ''You can hook a function like "AddonName:Function()" by replaceing the ":" with a "."'' (See [[Hooking_functions#Hooking_object_methods|Hooking object methods]])


== Post-hooking ==
== Post-hooking ==