Yuari
Documentation
Docs/Environment/filtergc

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

ParameterTypeDescription
typeOrPredicatestring | functionThe type or predicate value used by the call.
options?tableA table of options that controls the call.

Returns

TypeDescription
tableThe 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.