Skip to main content

SaveSlotUtils

Functions​

getDefaultSlotName​

SaveSlotUtils.getDefaultSlotName(slotIndex: number) → string

The name a slot gets when it is created without one, or when its name is cleared.

getTimePlayed​

SaveSlotUtils.getTimePlayed(
metadata: SaveSlotData.SaveSlotMetadata,
isActive: boolean,
now: number?
) → number

Seconds the slot has been played, current as of now (defaults to os.time()). TimePlayed only lands on the slot when its data saves or its session ends, so for the active slot the running session is re-derived: the total minus the part of it already credited to this session, plus the wall time since the slot was selected. It never reads below the credited total, so a client clock behind the server's cannot make it go backwards.

Show raw api
{
    "functions": [
        {
            "name": "getDefaultSlotName",
            "desc": "The name a slot gets when it is created without one, or when its name is cleared.",
            "params": [
                {
                    "name": "slotIndex",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 15,
                "path": "src/saveslot/src/Shared/SaveSlotUtils.lua"
            }
        },
        {
            "name": "getTimePlayed",
            "desc": "Seconds the slot has been played, current as of `now` (defaults to `os.time()`). `TimePlayed`\nonly lands on the slot when its data saves or its session ends, so for the active slot the\nrunning session is re-derived: the total minus the part of it already credited to this session,\nplus the wall time since the slot was selected. It never reads below the credited total, so a\nclient clock behind the server's cannot make it go backwards.",
            "params": [
                {
                    "name": "metadata",
                    "desc": "",
                    "lua_type": "SaveSlotData.SaveSlotMetadata"
                },
                {
                    "name": "isActive",
                    "desc": "",
                    "lua_type": "boolean"
                },
                {
                    "name": "now",
                    "desc": "",
                    "lua_type": "number?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 28,
                "path": "src/saveslot/src/Shared/SaveSlotUtils.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "SaveSlotUtils",
    "desc": "",
    "source": {
        "line": 5,
        "path": "src/saveslot/src/Shared/SaveSlotUtils.lua"
    }
}