filtergc
Filters the GC heap by type (table, function, thread, userdata, buffer) with an options table, or by a predicate function.
Syntax
filtergc(typeOrPredicate: string | function, options?: table) -> table
Parameters
| Parameter | Type | Description |
|---|---|---|
typeOrPredicate | string | function | The type or predicate value used by the call. |
options? | table | A table of options that controls the call. |
Returns
| Type | Description |
|---|---|
table | The returned collection or table. |
Description
filtergc is part of the Environment library. Environment helpers return or inspect the global, game and script environments used by the executor and the client.
The call is read-only: it resolves the current value when invoked and does not change the underlying state.
Example
local functions = filtergc("function")
print(#functions)
local tables = filtergc(function(value)
return type(value) == "table"
end)
print(#tables)
Notes
- Mutating a returned environment affects every script that shares it.