clonefunction
Creates a separate closure with the original function's behavior.
This clones a closure, not an entire graph of tables or captured state. Do not assume captured tables become independent copies.
clonefunction(callback: function): functionParameters
| Parameter | Type | Description |
|---|---|---|
callback | function | Function to clone. |
Example
local function original(value) return value + 1 end
local copy = clonefunction(original)
print(copy(5))Example output
6