Category
Closures
Inspect, create, clone, and replace closures.Category guide
Overview
Use this overview to understand the category before opening a specific function.- See what this group of functions is meant to solve.
- Compare function names and descriptions in one table.
- Open a function for syntax, arguments, returns, and examples.
Closures
Available functions
| Function | Description |
|---|---|
checkcaller | Returns whether the current Luau thread is present in Real caller context. |
clonefunction | Creates and returns a separate function value for the function passed as the first argument. |
comparefunctions | Compares two function values by their function identity. |
getfunctionhash | Returns an uppercase SHA384 hex digest derived from a Luau function. |
hookfunction | Replaces the behavior of a target function with a replacement function and returns a callable copy of the original behavior. |
hookmetamethod | Finds the named metamethod on a value and replaces that metamethod function with the provided replacement. |
iscclosure | Returns whether the provided function is a C closure. |
isexecutorclosure | Returns whether the provided function is classified as executor-owned. |
isfunctionhooked | Returns whether the provided function currently has a hook record. |
ishiddenstack | Returns whether a function, or the function at a stack level, is marked as hidden. |
islclosure | Returns whether the provided function is a Lua closure. |
isnewcclosure | Returns whether the provided function is a newcclosure-created C closure. |
newcclosure | Returns a C closure for the provided function. |
newlclosure | Returns a Luau closure that calls the provided function. |
restorefunction | Restores a hooked function, or replaces one function with another when two function arguments are provided. |
sethiddenstack | Marks or unmarks a function, or the function at a stack level, as hidden. |