Closures
Inspect, copy, wrap and hook functions. Entries: 13.
- checkcallerReturns true when the current thread was created by the executor rather than by the game. Use it inside a hook to tell your own calls apart from the game's.
boolean - clonefunctionReturns a copy of the given function that behaves identically but is a distinct value, so hooking or comparing one does not affect the other.
function - getfunctionhashReturns a SHA384 hash of the function's bytecode. Two functions compiled from identical source share a hash, which makes this useful for fingerprinting game functions across sessions.
string - hookfunctionReplaces a function with your own implementation and returns the original so you can still call it. The workhorse of most hooks.
function - hookmetamethodHooks a single metamethod on an object's metatable and returns the original. A shorthand for getrawmetatable plus setreadonly plus hookfunction.
function - iscclosureReturns true when the function is a C closure, implemented natively rather than in Luau.
boolean - isexecutorclosureReturns true when the function was created by the executor rather than by the game.
boolean - isfunctionhookedReturns true when the function has been replaced with hookfunction, and false for one that has not.
boolean - islclosureReturns true when the function is a Luau closure, written in Luau rather than natively.
boolean - loadstringCompiles a string of Luau source into a callable chunk. Returns nil plus an error message when the source fails to compile.
function?, string? - newcclosureWraps a Luau function so that it reports as a C closure. Used to disguise hooks and to bypass upvalue limits in hookfunction.
function - restorefunctionUndoes a hook applied with hookfunction or hookmetamethod and restores the original implementation.
() - setstackhiddenControls whether a function appears in stack traces and debug info. A hidden function is skipped when the stack is inspected, so it does not show up in debug.traceback.
()