→Hooking object:method()
mNo edit summary |
|||
| Line 35: | Line 35: | ||
'' This is only an example for how to hook, it will not actually show you the level anymore. '' -- [[User:Shadowed|Shadowed]] | '' This is only an example for how to hook, it will not actually show you the level anymore. '' -- [[User:Shadowed|Shadowed]] | ||
However, the above can be simplified even further if you plan to outright replace that code. To do so, you could use the following: | |||
function MyAddOn_OnLoad() | |||
OldFunction = NewFunction; | |||
end | |||
== Hooking object:method() == | |||
To hook "object:method()" to your own function "myfunction()", you'd hook it in the following manner: | |||
object.method() = myfunction; | |||
== An Easier Way to Hook a Function? == | == An Easier Way to Hook a Function? == | ||