Skip to main content

register_hook_function

Function register_hook_function 

Source
pub fn register_hook_function(
    lua: &Lua,
    registry: SharedHookRegistry,
    component_id: ComponentId,
) -> Result<(), LuaError>
Expand description

Registers the orcs.hook() function on the orcs global table.

Requires:

  • registry — the shared hook registry for storing hooks
  • component_id — the owning component (for register_owned())

The registered hooks are automatically cleaned up when HookRegistry::unregister_by_owner() is called with the same component ID (typically on component shutdown).

§Errors

Returns an error if Lua function creation or table insertion fails.