getgc
Retrieves all objects currently tracked by the Luau garbage collector.
function getgc(includeTablesincludeTablesboolean??When true, tables are included in the returned array in addition to functions and userdata.?: boolean): {function | userdata | table}{any}An array of all live objects currently tracked by the garbage collector.Usage
Find all live functions
local gc = getgc(false)
for _, obj in ipairs(gc) do
if type(obj) == "function" then
print(debug.info(obj, "sln"))
end
endFind a hidden table
local gc = getgc(true)
for _, obj in ipairs(gc) do
if type(obj) == "table" and obj.secretKey then
print("Found hidden table:", obj.secretKey)
end
end