compareclosures
Compares two closures while following hook aliases.
Syntax
compareclosures(a: any, b: any) -> boolean
Parameters
| Parameter | Type | Description |
|---|---|---|
a | any | The a value used by the call. |
b | any | The b value used by the call. |
Returns
| Type | Description |
|---|---|
boolean | The boolean result of the check. |
Description
compareclosures is part of the Closures library. Closure helpers operate on live Luau function objects. Hooks redirect future calls through the replacement closure and return the previous implementation.
The call is read-only: it resolves the current value when invoked and does not change the underlying state.
The aliases comparefunctions(a, b), comparefunction(a, b) resolve to the same implementation.
Example
local fn = function() end
local copy = clonefunction(fn)
print(compareclosures(fn, copy), comparefunctions(fn, fn))
Notes
- Aliases:
comparefunctions(a, b),comparefunction(a, b). - Closure operations act on live Luau function objects; installed hooks remain active until restored.