Syntax
getgc(includeTables?: boolean): tableAliases
get_gc_objectsArguments
| Name | Type | Description |
|---|---|---|
includeTables? | boolean | Optional boolean. When true, live tables are included in addition to functions and userdata-like objects. |
Returns
| Name | Type | Description |
|---|---|---|
objects | table | Array table containing matching live objects, plus live tables when includeTables is true. |
Description
Returns an array table of live Luau garbage-collected objects visible to the API. Functions and userdata-like objects are included by default. Tables are included only when includeTables is true. get_gc_objects is an alias.
Call it with 1 parameter(s): includeTables. The argument table explains which values are required and which ones only refine the behavior.
It returns objects (table). Use the returns table to separate successful values from nil results and recoverable errors.
Example
Read the current GC object list, optionally including tables.
local objects = getgc()
print(type(objects))
local withTables = getgc(true)
print(type(withTables))
local aliasResult = get_gc_objects()
print(type(aliasResult))