Skip to content
Axiom/Docs

hook

@1NEEDS A GRANT

Subscribing to a game function by name, with a priority. The core owns the detour.

By name, never by address: the mod says which function and the host resolves it through the pack, so two mods on one function is ordinary rather than a collision. The core owning the detour is what makes that true, and it is also what makes unhooking something the host can do without asking the mod.

3 callsSurface as of 2026-10-21
Never granted automatically

The core owns the detour, and a detour is the most direct thing a mod can do to a running process. Never automatic.

Types

TYPESfrom the IDL
struct HookId { index: u32, generation: u32 }

Calls

attachWRITES
attach(function: str, priority: u32) -> Result<HookId>

Higher priority runs first. Two mods asking for the same priority are ordered by the resolved load order, so the answer is the same on every machine.

In C, from surface.h
int32_t axiom_hook_attach(const char* function, uint32_t function_length, uint32_t priority, AxiomHookHookId* out);
detachWRITES
detach(hook: HookId) -> Result<>
In C, from surface.h
int32_t axiom_hook_detach(uint32_t hook_index, uint32_t hook_generation);
attached
attached(function: str) -> Result<bool>
In C, from surface.h
int32_t axiom_hook_attached(const char* function, uint32_t function_length, int32_t* out);

Events

calledhook: HookId

Errors

A call that returns Result crosses as a status: 0 is success, and the others are these errors, by their index in the capability.

UnresolvedNoPackDenied