cache.replace

Replaces an instance's cached wrapper.

Syntax

Signature
cache.replace(Instance: Instance, Replacement: function) -> ()

Aliases

This function has no aliases.

Parameters

ParameterTypeDescription
InstanceInstanceInstance reference to inspect.
ReplacementfunctionFunction used instead of the target.

Returns

TypeDescription
()None.

Notes

Both arguments must be instance wrappers. This changes future cache lookups and does not replace a scene object. The native cache must be available and writable.

Example

Luau
local Players = game:GetService("Players")
cache.replace(Players, cloneref(Players))
print(cache.iscached(Players))