newlclosure
Creates a Luau closure wrapper that preserves the original function and its environment.
Syntax
newlclosure(fn: function) -> function
Parameters
| Parameter | Type | Description |
|---|---|---|
fn | function | The function or callback to use. |
Returns
| Type | Description |
|---|---|
function | The returned function. |
Description
newlclosure 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.
Each call creates or returns a fresh object or value that you can store and pass to other functions.
Example
local wrapped = newlclosure(function(value)
return value
end)
print(wrapped("hello"))
Notes
- Closure operations act on live Luau function objects; installed hooks remain active until restored.