hooks.Add
address. Returns the original function as a callable FFI pointer of the same type.
The callback must match the function type. On x64,
__fastcall is suitable for all calling conventions.
hooks.Remove
Calling the original
hooks.Add returns the original function as a typed FFI pointer. Call it like any other function:
Lifecycle
hooks.Addis load-time only, same asevents.On- Detours are uninstalled when a script is unloaded or disabled
- Maximum 32 hooks per script
- Cannot hook the address of a function inside Starline’s own module
- The FFI callback stays alive until the hook is removed
Low-level API
For advanced use, the raw primitives are available:hooks.Create takes two raw addresses and returns the trampoline address. Null, duplicate, and protected targets error. Installation failure returns nil, error.
hooks.Add is built on top of these and handles FFI callback creation, type casting, and GC anchoring for you.