oth.is_hook_thread Synchronous

Report whether the current coroutine is running an OTH callback. Use it to distinguish callback work from ordinary script work.

Syntax
Luau
oth.is_hook_thread() -> boolean

Parameters

This function takes no arguments.

Returns

boolean

true inside an OTH hook callback; false outside it.

Usage notes

This reports the current coroutine only. It does not say whether any hooks are installed elsewhere.

Example

Example
Luau
print(oth.is_hook_thread()) -- false outside a callback
local target = newcclosure(function() return "original" end)
local previous = oth.hook(target, function()
    print(oth.is_hook_thread()) -- true here
    return "hooked"
end)
print(target())
oth.unhook(target, previous)
Kawaii documentation