clonefunction
Returns a copy of the given function that behaves identically but is a distinct value, so hooking or comparing one does not affect the other.
Signature
clonefunction<A..., R...>(fn: (A...) -> R...): (A...) -> R...Parameters
fn(A...) -> R...The function to duplicate.
Returns
function
Example
local original = print
local copy = clonefunction(original)
print(copy == original) --> false
copy("still prints")