filtergc Filters objects in the garbage collector based on specified criteria.
filtergc ( type : string, options : table) -> table
Parameter Type Description typestringThe type of object to find ("function" or "table") optionstableFilter options
Type Description tableArray of matching objects
filtergc efficiently searches through garbage-collected objects with specific filter criteria. This is more performant than manually iterating through getgc().
Option Type Description NamestringMatch function name ConstantstableMatch constants in function UpvaluestableMatch upvalue values IgnoreExecutorbooleanExclude volt functions
Option Type Description KeystableMatch table keys ValuestableMatch table values KeyValuePairstableMatch key-value pairs MetatabletableMatch metatable
local functions = filtergc ( "function" , {
Name = "targetFunction"
})
for _, func in ipairs (functions) do
print ( "Found:" , func)
end
local functions = filtergc ( "function" , {
Constants = { "SomeUniqueString" , "AnotherString" }
})
local tables = filtergc ( "table" , {
Keys = { "Health" , "MaxHealth" , "Damage" }
})
for _, tbl in ipairs (tables) do
print ( "Found table with game stats" )
end
local gameFunctions = filtergc ( "function" , {
Name = "Update" ,
IgnoreExecutor = true
})
getgc - Get all GC objects