getobjectreferences Synchronous
Find the tables that hold a given table, as a key or as a value. It answers “what is keeping this table reachable?” when you track down where a game stores some state.
Luau
getobjectreferences(target: Table) -> {Table}Parameters
| Parameter | Type | Description |
|---|---|---|
target | Table | The table to look for. Passing anything else raises an error. |
Returns
{Table}An array of the other live tables that contain target as a key or value. The target itself is not included.
Usage notes
Only tables are searched as holders; a closure that captures the table as an upvalue is not reported. The result is a snapshot of the current VM.
Example
Luau
local state = { coins = 10 }
local holder = { current = state }
for _, owner in ipairs(getobjectreferences(state)) do
print(owner == holder)
end