Skip to content
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#

Luau
isfunctionhooked(target: function): boolean

Parameters#

ParameterTypeDescription
targetfunctionThe exact function value to inspect or modify.

Returns#

A boolean result; non-function arguments raise a type error.

Examples#

Example

Luau
local function f() return 1 end
hookfunction(f, function() return 2 end)
print(isfunctionhooked(f)) -- true
restorefunction(f)
print(isfunctionhooked(f)) -- false