hookfunction
Notes on hookfunction
The hook should not have more upvalues than the function you want to hook. There are ways to bypass the upvalue restriction, such as using newlclosure
or newcclosure
to wrap the hook
All possible hooking closure pairs should be supported throughout L, NC, C (where NC = newcclosure
)
hookfunction
allows you to hook a function with another wanted function, returning the original unhooked function.
function hookfunction<A1..., R1...>(functionToHook: (A1...) -> R1..., hook: (A1...) -> R1...): (A1...) -> R1...
Parameters
Parameter | Description |
---|---|
functionToHook |
The function that will be hooked |
hook |
The function that will be used as a hook |
Example
Hooking functions with hookfunction | |
---|---|