true to also include tables, userdata, and threads.
Parameters
boolean
default:"false"
When
true, the result also contains tables, userdata, and threads. When
false or omitted, only functions are returned.Returns
table
A fresh array (1-indexed) of the matching objects. The array itself is not
included in its own result.
Behavior
The walk is a point-in-time snapshot of one VM:- Only live objects are included. Objects already marked dead by the collector are skipped.
- The result is scoped to the Lua state you call from. Objects belonging to other Actor VMs are not visible here. Use the actors library to reach those states.
- Proto objects and other internal-only collectables are never returned; the set
is limited to functions and, with
includeTables, tables, userdata, and threads.
filtergc instead. Walking the full getgc result in
Luau allocates a large array and then throws most of it away, whereas filtergc
matches during the walk and keeps only what you asked for.
Example
Pull in every collectable category and tally what’s live by type:Errors
Related
filtergc: targeted search without building the full set.getallthreads: just the threads, directly.