getgc
Returns every function currently tracked by the garbage collector, optionally including tables. Prefer filtergc when you know what you are looking for.
Signature
getgc(includeTables: boolean?): { function | table }Parameters
includeTablesboolean?Include tables in the result. Defaults to false.
Returns
{ any }
Example
local functions = 0
for _, value in getgc() do
if type(value) == "function" then
functions += 1
end
end
print(functions, "functions are alive")
local withTables = getgc(true)
print(#withTables, "objects including tables")