util.monitor.list

Client

Retrieves all available stats, grouped by native and custom


Syntax

local result = util.monitor.list()

Parameters

No parameters are accepted by this function

Returns

TypeNameDescription
tableresultTable containing sub-tables:
native - all built-in Godot stats listed
custom - all currently registered custom stats listed
Refer Structure section

Structure

result.native — Array of entries for all built-in Godot stats

FieldTypeDescription
idintEnum value usable with util.monitor.get and util.monitor.has
namestringConstant name from the util.monitor.stat_native enum
formatutil.monitor.stat_formatFormat indicating how the stat's value should be interpreted/displayed

result.custom — Array of entries for all currently registered custom stats

FieldTypeDescription
idstringRegistered string id usable with util.monitor.get and util.monitor.has
namestringHuman-readable display name provided at registration
formatutil.monitor.stat_formatFormat indicating how the stat's value should be interpreted/displayed

Examples

Print all available stats
local stats = util.monitor.list()

core.engine.print("info", "Native stats:", #stats.native)
core.engine.print("info", "Custom stats:", #stats.custom)
Iterate over native stats
local stats = util.monitor.list()

for _, entry in ipairs(stats.native) do
    core.engine.print("info", entry.name, "=", util.monitor.get(entry.id), "(format:", entry.format, ")")
end
Iterate over custom stats
local stats = util.monitor.list()

for _, entry in ipairs(stats.custom) do
    core.engine.print("info", entry.name, "=", util.monitor.get(entry.id), "(format:", entry.format, ")")
end
Check if any custom stats are registered
local stats = util.monitor.list()

if #stats.custom == 0 then
    core.engine.print("warn", "No custom stats registered")
end

On this page