cloneref Asynchronous
clonereference
Make a separate Luau wrapper for an existing Instance without cloning the engine object. It helps distinguish userdata identity from Instance identity when testing cache behavior.
Luau
cloneref(instance: Instance) -> InstanceParameters
| Parameter | Type | Description |
|---|---|---|
instance | Instance | Instance for which to create an uncached reference. |
Returns
InstanceA second wrapper for the same underlying Instance. Mutations through either reference affect the same object.
Usage notes
The new wrapper does not become canonical automatically. In some native namecall hook contexts this call may yield while the original thread creates the wrapper.
Example
Luau
local folder = Instance.new("Folder")
local anotherReference = cloneref(folder)
print(folder == anotherReference) -- wrapper identity can differ
print(compareinstances(folder, anotherReference)) -- true
folder.Name = "Shared object"
print(anotherReference.Name)
folder:Destroy()