Volt

filtergc

Filters objects in the garbage collector based on specified criteria.

Syntax

filtergc(type: string, options: table) -> table

Parameters

ParameterTypeDescription
typestringThe type of object to find ("function" or "table")
optionstableFilter options

Returns

TypeDescription
tableArray of matching objects

Description

filtergc efficiently searches through garbage-collected objects with specific filter criteria. This is more performant than manually iterating through getgc().

Function Filter Options

OptionTypeDescription
NamestringMatch function name
ConstantstableMatch constants in function
UpvaluestableMatch upvalue values
IgnoreExecutorbooleanExclude volt functions

Table Filter Options

OptionTypeDescription
KeystableMatch table keys
ValuestableMatch table values
KeyValuePairstableMatch key-value pairs
MetatabletableMatch metatable

Example: Find Function by Name

local functions = filtergc("function", {
    Name = "targetFunction"
})

for _, func in ipairs(functions) do
    print("Found:", func)
end

Example: Find Function by Constants

local functions = filtergc("function", {
    Constants = {"SomeUniqueString", "AnotherString"}
})

Example: Find Table by Keys

local tables = filtergc("table", {
    Keys = {"Health", "MaxHealth", "Damage"}
})

for _, tbl in ipairs(tables) do
    print("Found table with game stats")
end

Example: Ignore Volt Functions

local gameFunctions = filtergc("function", {
    Name = "Update",
    IgnoreExecutor = true
})
  • getgc - Get all GC objects

On this page