Skip to main content
Returns a copy of func that runs the same code, but is a separate function: clone == func is always false.
Works on Lclosures/CClosures. The bytecode is identical, so getfunctionhash(clone) == getfunctionhash(func). Mainly used to grab a clean copy of a function before some other script hooks it.
The clone keeps the original behavior, so calls through it bypass the hook entirely:

Parameters

Returns

function - same code as func, with its own memory address.
Each call to clonefunction returns a new function - clone the same one 10 times, and you get 10 separate copies of it.

Example

Always check parameters and return values when working with this library function.