isfunctionhooked Synchronous
Check whether a function currently has a live hook. Use it before restoring a hook when the same cleanup path may run twice.
Luau
isfunctionhooked(value: Function) -> booleanParameters
| Parameter | Type | Description |
|---|---|---|
value | Function | The function to inspect. Passing a non-function raises an error. |
Returns
booleantrue while a hook is active; false after its logical restoration.
Example
Luau
local target = newcclosure(function(n) return n end)
local previous
previous = hookfunction(target, function(n) return previous(n) + 1 end)
print(isfunctionhooked(target)) -- true
restorefunction(target)
print(isfunctionhooked(target)) -- false