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
| Type | Name | Description |
|---|---|---|
table | result | Table containing sub-tables: • native - all built-in Godot stats listed• custom - all currently registered custom stats listedRefer Structure section |
Structure
result.native — Array of entries for all built-in Godot stats
| Field | Type | Description |
|---|---|---|
id | int | Enum value usable with util.monitor.get and util.monitor.has |
name | string | Constant name from the util.monitor.stat_native enum |
format | util.monitor.stat_format | Format indicating how the stat's value should be interpreted/displayed |
result.custom — Array of entries for all currently registered custom stats
| Field | Type | Description |
|---|---|---|
id | string | Registered string id usable with util.monitor.get and util.monitor.has |
name | string | Human-readable display name provided at registration |
format | util.monitor.stat_format | Format indicating how the stat's value should be interpreted/displayed |
Examples
local stats = util.monitor.list()
core.engine.print("info", "Native stats:", #stats.native)
core.engine.print("info", "Custom stats:", #stats.custom)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, ")")
endlocal 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, ")")
endlocal stats = util.monitor.list()
if #stats.custom == 0 then
core.engine.print("warn", "No custom stats registered")
end