Functions & closuresReference
isfunctionhooked
Reports function interception state.
Details#
Reports whether the supplied function has an active function-hook record. Use it to distinguish the target from a saved original; restoration clears the target's hook status.
Signature#
isfunctionhooked(target: function): booleanParameters#
| Parameter | Type | Description |
|---|---|---|
target | function | The exact function value to inspect or modify. |
Returns#
A boolean result; non-function arguments raise a type error.
Examples#
Example
local function f() return 1 end
hookfunction(f, function() return 2 end)
print(isfunctionhooked(f)) -- true
restorefunction(f)
print(isfunctionhooked(f)) -- false