ReferenceInstances

getinstancecache

Returns the table the engine uses to give each Instance one Luau value.

Syntax

getinstancecache() -> table

Returns

TypeDescription
tableThe engine's own table mapping Instances to their Luau references.

Description

This is the engine's table itself, not a copy. Its keys are internal and its values are the userdata references scripts receive. The cache.invalidate library changes individual entries safely; prefer it to editing this table directly.

Example

local cache = getinstancecache()
local count = 0
for _ in cache do
    count += 1
end
print(count, "cached references")

Notes

These are Game executor contracts. Check build requirements and session lifetimes before using them.