Environment

getgc

返回 Luau 垃圾收集器当前跟踪的对象。

语法

getgc(includeTables?: boolean): table
别名 get_gc_objects

参数

名称类型描述
includeTables?boolean如果为 true,表值将包含在垃圾收集器结果中。

返回值

名称类型描述
objectstable加载器或垃圾收集器返回的对象的数组表。

说明

返回 Luau 垃圾收集器当前跟踪的对象。

使用 1 个参数调用: includeTables。参数表会说明哪些值必填,哪些值只用于细化行为。

返回 objects (table)。使用返回表区分成功值、nil 结果和可恢复错误。

示例

使用占位值的示例调用。

local result = getgc(true)
print(result)