Skip to main content

SaveSlotCmdrUtils

Functions

formatValue

SaveSlotCmdrUtils.formatValue(
valueany,
depthnumber?--

defaults to 3

) → string

Renders a JSON-shaped value on a single line, for console output. Tables become {a = 1, b = 2} and arrays [1, 2], nested up to depth levels before collapsing to "...".

formatDuration

SaveSlotCmdrUtils.formatDuration(secondsnumber) → string

Renders a duration in seconds as "1h 23m", "23m", or "45s".

formatTimestamp

SaveSlotCmdrUtils.formatTimestamp(
unixTimenumber,
nownumber?--

defaults to os.time()

) → string

Renders a unix timestamp as UTC plus how long ago it was, e.g. "2026-08-12 14:03 UTC (3h ago)". The relative part is what an admin actually reads; the absolute one is what they quote back.

formatSummaryLines

SaveSlotCmdrUtils.formatSummaryLines(summarySaveSlotData.SaveSlotSummary | string | nil) → {string}

Renders a slot's SaveSlotData.SaveSlotSummary as one line per summary provider, keyed by provider name (see HasSaveSlots.RegisterSummaryProvider). A legacy plain-string summary is passed through as its own line, and a summary with nothing in it yields no lines at all.

formatSlotBlock

SaveSlotCmdrUtils.formatSlotBlock(
metadataSaveSlotData.SaveSlotMetadata,
statusstring?,--

appended to the header, e.g. "Active"

nownumber?--

defaults to os.time(), for the relative timestamps

) → string

Renders one slot as the block saveslot-list prints for it: a header naming the slot, then an indented line of playtime and timestamps, then a line per summary provider. Lines with nothing behind them are left out, so a slot that has never been played prints as its header alone.

Show raw api
{
    "functions": [
        {
            "name": "formatValue",
            "desc": "Renders a JSON-shaped value on a single line, for console output. Tables become `{a = 1, b = 2}`\nand arrays `[1, 2]`, nested up to `depth` levels before collapsing to \"...\".",
            "params": [
                {
                    "name": "value",
                    "desc": "",
                    "lua_type": "any"
                },
                {
                    "name": "depth",
                    "desc": "defaults to 3",
                    "lua_type": "number?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 134,
                "path": "src/saveslot/src/Shared/Cmdr/SaveSlotCmdrUtils.lua"
            }
        },
        {
            "name": "formatDuration",
            "desc": "Renders a duration in seconds as \"1h 23m\", \"23m\", or \"45s\".",
            "params": [
                {
                    "name": "seconds",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 161,
                "path": "src/saveslot/src/Shared/Cmdr/SaveSlotCmdrUtils.lua"
            }
        },
        {
            "name": "formatTimestamp",
            "desc": "Renders a unix timestamp as UTC plus how long ago it was, e.g. \"2026-08-12 14:03 UTC (3h ago)\".\nThe relative part is what an admin actually reads; the absolute one is what they quote back.",
            "params": [
                {
                    "name": "unixTime",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "now",
                    "desc": "defaults to os.time()",
                    "lua_type": "number?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 183,
                "path": "src/saveslot/src/Shared/Cmdr/SaveSlotCmdrUtils.lua"
            }
        },
        {
            "name": "formatSummaryLines",
            "desc": "Renders a slot's [SaveSlotData.SaveSlotSummary] as one line per summary provider, keyed by provider\nname (see [HasSaveSlots.RegisterSummaryProvider]). A legacy plain-string summary is passed through\nas its own line, and a summary with nothing in it yields no lines at all.",
            "params": [
                {
                    "name": "summary",
                    "desc": "",
                    "lua_type": "SaveSlotData.SaveSlotSummary | string | nil"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ string }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 212,
                "path": "src/saveslot/src/Shared/Cmdr/SaveSlotCmdrUtils.lua"
            }
        },
        {
            "name": "formatSlotBlock",
            "desc": "Renders one slot as the block `saveslot-list` prints for it: a header naming the slot, then an\nindented line of playtime and timestamps, then a line per summary provider. Lines with nothing\nbehind them are left out, so a slot that has never been played prints as its header alone.",
            "params": [
                {
                    "name": "metadata",
                    "desc": "",
                    "lua_type": "SaveSlotData.SaveSlotMetadata"
                },
                {
                    "name": "status",
                    "desc": "appended to the header, e.g. \"Active\"",
                    "lua_type": "string?"
                },
                {
                    "name": "now",
                    "desc": "defaults to os.time(), for the relative timestamps",
                    "lua_type": "number?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 249,
                "path": "src/saveslot/src/Shared/Cmdr/SaveSlotCmdrUtils.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "SaveSlotCmdrUtils",
    "desc": "",
    "source": {
        "line": 5,
        "path": "src/saveslot/src/Shared/Cmdr/SaveSlotCmdrUtils.lua"
    }
}