Functions
| Function | Returns | Description |
|---|---|---|
hooks.add(target, detour) | hook, original | Install a detour at address target |
hooks.remove(target) | bool | Remove hook by target address |
hooks.list() | table | Array of this script’s hook objects |
Hook methods
| Method | Returns | Description |
|---|---|---|
hook:original() | number | Address of the original function |
hook:target() | number | Hooked target address |
hook:active() | bool | Whether the hook is live |
hook:remove() | bool | Remove this hook |
Example
local addr = memory.find_pattern('client.dll', '48 89 5C 24 ? 57 48 83 EC 20 ...')
local h, orig = hooks.add(addr, function(rcx, rdx)
-- call original
-- return value
end)
events.on('unload', function()
h:remove()
end)