Skip to content
Scripts & runtimeOverview

getgc

Represents inspection of garbage-collected runtime objects.

Details#

Returns discoverable garbage-collected runtime values; the optional includeTables flag includes tables. The result changes with allocation and collection, and table/function values are shared references. It does not force collection.

Examples#

Example

Luau
local marker = { docsMarker = true }
local found = false
for _, value in pairs(getgc(true)) do
    if value == marker then found = true end
end
print(found, marker.docsMarker)