WoW:Hooking functions: Difference between revisions

m
(→‎Hooking a function: SetItemRef -> ChatFrame_OnHyperlinkShow)
Line 65: Line 65:
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 "."''
* ''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 ==
Anonymous user