getinstancecache
Returns the table the engine uses to give each Instance one Luau value.
Syntax
getinstancecache() -> table
Returns
| Type | Description |
|---|---|
table | The 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
- Each Actor state has its own cache, so this returns the current state's table. The keys are raw native Instance pointers represented as lightuserdata; converting or logging them exposes process address values. Prefer
cache.iscachedand the cache library over enumerating this table.
These are Game executor contracts. Check build requirements and session lifetimes before using them.
