VINDICTA
Hooking · Function Unregistered
Bunni.fun
ChocoSploit
Cryptic
Potassium
Seliware
SirHurt
Solara
Velocity
Volcano
Volt
Wave
Xeno

isfunctionhooked

Returns whether a function has been hooked by a prior hookfunction call.

Unregistered
This function is not registered within sUNC, your executor may/may not have this.
function isfunctionhooked(func: function): boolean

Synopsis

How it works

The executor maintains an internal hook registryLua registryA hidden global table at pseudo-index LUA_REGISTRYINDEX, used by C code to store persistent references. Contains _LOADED (module cache), lua_ref references, thread refs, and callback storage. Shared across all threads in the VM. that maps original function pointers to their hook state. isfunctionhooked checks this registry to determine if hookfunction has been applied to the target. It does not scan bytecodeBytecodeThe compiled binary representation of Luau source code. A sequence of 32-bit instructions (opcodes + operands) stored in a Proto's code[] array. Executed by the Luau VM interpreter. — it's a simple registry lookup.

Under the hood

When hookfunction(target, hook) is called, the executor stores the original function's address and the hook's trampolineTrampolineA wrapper function that bounces (redirects) calls to another function. In executor context, newcclosure creates a C closure trampoline that calls the Luau function stored in its first upvalue. in a hash mapHash tableA data structure that maps keys to values using a hash function. Luau tables use a hash table for string/mixed keys (the "node" part) alongside a separate contiguous array for integer keys.. isfunctionhooked queries this map. This means it only detects hooks placed by the executor itself — not manual bytecodeBytecodeThe compiled binary representation of Luau source code. A sequence of 32-bit instructions (opcodes + operands) stored in a Proto's code[] array. Executed by the Luau VM interpreter. patches or metamethodMetamethodA function in a metatable that overrides default behavior for operations like indexing (__index), assignment (__newindex), calling (__call), comparison (__eq), and arithmetic (__add, __mul, etc.). replacements.

Usage

Check hook status
function a(num)
    print(num)
end
print(isfunctionhooked(a)) "cc">--> false
hookfunction(a, function(num) old(num + 1) end)
print(isfunctionhooked(a)) "cc">--> true

Parameters

func function
The function to check.

Returns

boolean true if the function has been hooked.