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

16 functions
FunctionDescription
checkcallerReturns whether the current Luau thread is present in Real caller context.
clonefunctionCreates and returns a separate function value for the function passed as the first argument.
comparefunctionsCompares two function values by their function identity.
getfunctionhashReturns an uppercase SHA384 hex digest derived from a Luau function.
hookfunctionReplaces the behavior of a target function with a replacement function and returns a callable copy of the original behavior.
hookmetamethodFinds the named metamethod on a value and replaces that metamethod function with the provided replacement.
iscclosureReturns whether the provided function is a C closure.
isexecutorclosureReturns whether the provided function is classified as executor-owned.
isfunctionhookedReturns whether the provided function currently has a hook record.
ishiddenstackReturns whether a function, or the function at a stack level, is marked as hidden.
islclosureReturns whether the provided function is a Lua closure.
isnewcclosureReturns whether the provided function is a newcclosure-created C closure.
newcclosureReturns a C closure for the provided function.
newlclosureReturns a Luau closure that calls the provided function.
restorefunctionRestores a hooked function, or replaces one function with another when two function arguments are provided.
sethiddenstackMarks or unmarks a function, or the function at a stack level, as hidden.