Hooks a C closure so its calls run hook instead, and returns a callable for the original. The hook runs on a dedicated thread, which keeps the game’s call context clean while your Luau callback does its work.

Parameters

function
required
The C closure to hook.
function
required
The Luau callback to run instead.

Returns

function
A callable for the original behavior.

Example

Errors