cache.replace
Replaces the cached reference returned for an Instance.
Syntax
cache.replace(object: Instance, replacement: Instance) -> ()
Also available as
cache_replace
Parameters
| Parameter | Type | Description |
|---|---|---|
object | Instance | Cache entry to replace. |
replacement | Instance | Reference to use for future lookups. |
Description
Subsequent lookups of object can return replacement’s reference. Previously held references do not change, and the underlying Instances are not merged or reparented. Keep this separate from changing an Instance property.
Example
local function replaceCachedReference(object, replacement)
cache.replace(object, replacement)
end
These are Game executor contracts. Check build requirements and session lifetimes before using them.
