oth.hook
Installs a low-level function hook.
Syntax
oth.hook(target: any, hook: function) -> nil
Parameters
| Parameter | Type | Description |
|---|---|---|
target | any | The function or object being targeted. |
hook | function | The replacement callback that receives the original arguments. |
Returns
| Type | Description |
|---|---|
nil | This function does not return a value. |
Description
oth.hook is part of the Oth library. Oth works at the raw hook layer. It installs function hooks, exposes their handles and provides trampoline calls.
The hook affects future calls. Keep the returned original or handle if you need to delegate calls or undo the change later.
Example
local handle = oth.hook(print, function(...) return end)
print(handle)
Notes
- Raw hooks bypass closure-level safety; always keep the returned handle so you can unhook.