getgc
With no argument, returns GC statistics (same shape as getgc_info). With true, returns a generic-for iterator over every live table in the game's VM (up to 120,000 entries).
Syntax
getgc(includeTables?: any) -> table
Parameters
| Parameter | Type | Description |
|---|---|---|
includeTables? | any | The include tables value used by the call. |
Returns
| Type | Description |
|---|---|
table | Info table | iterator, table, 0 |
Description
getgc is part of the GC & memory scanning library. GC helpers read the game's Luau heap from outside the process and can inspect or control the collector.
The call is read-only: it resolves the current value when invoked and does not change the underlying state.
Example
for _, tbl in getgc(true) do
local v = rawget(tbl, "Money")
if type(v) == "number" then
print("found:", v)
end
end
Notes
- GC results depend on the live game heap and collector state.