Skip to main content

SaveSlotDataService

Functions

ObserveActiveSlotId

SaveSlotDataService.ObserveActiveSlotId() → Observable.Observable<SaveSlotData.SlotId?>

Observes the player's active slot ID. Emits nil -- rather than staying silent -- while the implementation has not replicated yet, so a subscriber always has a current answer.

ObserveLastActiveSlotId

SaveSlotDataService.ObserveLastActiveSlotId() → Observable.Observable<SaveSlotData.SlotId?>

Observes the player's last active slot ID (the slot they can continue on). Emits nil -- rather than staying silent -- while the implementation has not replicated yet.

GetActiveSlotId

SaveSlotDataService.GetActiveSlotId() → SaveSlotData.SlotId?

Returns the player's active slot ID

GetLastActiveSlotId

SaveSlotDataService.GetLastActiveSlotId() → SaveSlotData.SlotId?

Returns the player's last active slot ID -- the active slot when one is selected, otherwise the slot they last played and can continue on. This is the slot the "." shorthand resolves to in the save-slot Cmdr commands. The synchronous counterpart to SaveSlotDataService.ObserveLastActiveSlotId.

ObserveSlotList

SaveSlotDataService.ObserveSlotList(
playerPlayer
) → Observable.Observable<{SaveSlotData.SaveSlotMetadata}?>

Observes the player's active slot list. Ephemeral slots (see HasSaveSlots.PromiseSelectEphemeralSlot) are excluded -- observe the active slot's metadata directly with SaveSlotDataService.ObserveSlotMetadata to see one.

Emits nil while the slot container has not replicated, then one entry per slot, re-emitting whenever a slot is added or removed or any slot's own metadata changes.

GetSlotList

SaveSlotDataService.GetSlotList(
playerPlayer
) → {SaveSlotData.SaveSlotMetadata}

Returns the player's slot list. Ephemeral slots (see HasSaveSlots.PromiseSelectEphemeralSlot) are excluded -- read the active slot's metadata directly with SaveSlotDataService.GetSlotMetadata to see one.

ObserveSlotMetadata

SaveSlotDataService.ObserveSlotMetadata(
playerPlayer,
slotIdSaveSlotData.SlotId
) → Observable.Observable<SaveSlotData.SaveSlotMetadata?>

Observes the slot metadata with the given ID for the player. Order-independent: the slot container, the slot folder, and the slot's own attributes each replicate on their own schedule, so this emits nil until the slot is actually there, the metadata once it is, again on every attribute that lands afterwards, and nil again the moment the slot goes away (which is how an ephemeral slot ends).

GetSlotMetadata

SaveSlotDataService.GetSlotMetadata(
playerPlayer,
slotIdSaveSlotData.SlotId
) → SaveSlotData.SaveSlotMetadata?

Returns the slot metadata with the given ID for the player

ObserveActiveSlotMetadata

SaveSlotDataService.ObserveActiveSlotMetadata() → Observable.Observable<SaveSlotData.SaveSlotMetadata?>

Observes the metadata of whichever slot is currently active, following the selection as it changes and emitting nil while no slot is active. This is the read a UI showing "what am I playing right now" wants: composing SaveSlotDataService.ObserveActiveSlotId with SaveSlotDataService.ObserveSlotMetadata by hand is easy to get wrong, because the active-slot id and the slot folder it names replicate independently -- the id routinely arrives first.

An ephemeral slot is included here (it is genuinely the active slot); it is only the list reads that exclude it.

GetActiveSlotMetadata

SaveSlotDataService.GetActiveSlotMetadata() → SaveSlotData.SaveSlotMetadata?

Returns the metadata of whichever slot is currently active, or nil when no slot is active or its metadata has not replicated yet. The synchronous counterpart to SaveSlotDataService.ObserveActiveSlotMetadata.

ObserveIsActiveSlotEphemeral

SaveSlotDataService.ObserveIsActiveSlotEphemeral() → Observable.Observable<boolean>

Observes whether the active slot is an ephemeral, never-persisted one (see HasSaveSlots.PromiseSelectEphemeralSlot) -- what a UI checks before offering "save", "delete", or anything else that only makes sense on a real save.

Emits false while the answer is not known yet (no slot active, or the slot's metadata still in flight) and flips to true once the slot's IsEphemeral attribute lands, so a late attribute downgrades the UI rather than the reverse. Deduplicated, so it only emits on genuine changes.

IsActiveSlotEphemeral

SaveSlotDataService.IsActiveSlotEphemeral() → boolean

Returns whether the active slot is an ephemeral, never-persisted one. False when no slot is active or its metadata has not replicated yet. The synchronous counterpart to SaveSlotDataService.ObserveIsActiveSlotEphemeral.

GetSlotIdFromIndex

SaveSlotDataService.GetSlotIdFromIndex(
playerPlayer,
slotIndexnumber
) → SaveSlotData.SlotId?

Returns the ID for the slot at the given index

Show raw api
{
    "functions": [
        {
            "name": "ObserveActiveSlotId",
            "desc": "Observes the player's active slot ID. Emits nil -- rather than staying silent -- while the\nimplementation has not replicated yet, so a subscriber always has a current answer.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "SaveSlotDataService"
                },
                {
                    "name": "player",
                    "desc": "",
                    "lua_type": "Player\n"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable.Observable<SaveSlotData.SlotId?>\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 45,
                "path": "src/saveslot/src/Shared/SaveSlotDataService.lua"
            }
        },
        {
            "name": "ObserveLastActiveSlotId",
            "desc": "Observes the player's last active slot ID (the slot they can continue on). Emits nil -- rather than\nstaying silent -- while the implementation has not replicated yet.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "SaveSlotDataService"
                },
                {
                    "name": "player",
                    "desc": "",
                    "lua_type": "Player\n"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable.Observable<SaveSlotData.SlotId?>\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 62,
                "path": "src/saveslot/src/Shared/SaveSlotDataService.lua"
            }
        },
        {
            "name": "GetActiveSlotId",
            "desc": "Returns the player's active slot ID",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "SaveSlotDataService"
                },
                {
                    "name": "player",
                    "desc": "",
                    "lua_type": "Player"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "SaveSlotData.SlotId?\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 78,
                "path": "src/saveslot/src/Shared/SaveSlotDataService.lua"
            }
        },
        {
            "name": "GetLastActiveSlotId",
            "desc": "Returns the player's last active slot ID -- the active slot when one is selected, otherwise the\nslot they last played and can continue on. This is the slot the \".\" shorthand resolves to in the\nsave-slot Cmdr commands. The synchronous counterpart to\n[SaveSlotDataService.ObserveLastActiveSlotId].",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "SaveSlotDataService"
                },
                {
                    "name": "player",
                    "desc": "",
                    "lua_type": "Player"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "SaveSlotData.SlotId?\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 89,
                "path": "src/saveslot/src/Shared/SaveSlotDataService.lua"
            }
        },
        {
            "name": "ObserveSlotList",
            "desc": "Observes the player's active slot list. Ephemeral slots (see\n[HasSaveSlots.PromiseSelectEphemeralSlot]) are excluded -- observe the active slot's metadata\ndirectly with [SaveSlotDataService.ObserveSlotMetadata] to see one.\n\nEmits nil while the slot container has not replicated, then one entry per slot, re-emitting whenever\na slot is added or removed or any slot's own metadata changes.",
            "params": [
                {
                    "name": "_self",
                    "desc": "",
                    "lua_type": "SaveSlotDataService"
                },
                {
                    "name": "player",
                    "desc": "",
                    "lua_type": "Player\n"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable.Observable<{ SaveSlotData.SaveSlotMetadata }?>\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 119,
                "path": "src/saveslot/src/Shared/SaveSlotDataService.lua"
            }
        },
        {
            "name": "GetSlotList",
            "desc": "Returns the player's slot list. Ephemeral slots (see\n[HasSaveSlots.PromiseSelectEphemeralSlot]) are excluded -- read the active slot's metadata directly\nwith [SaveSlotDataService.GetSlotMetadata] to see one.",
            "params": [
                {
                    "name": "_self",
                    "desc": "",
                    "lua_type": "SaveSlotDataService"
                },
                {
                    "name": "player",
                    "desc": "",
                    "lua_type": "Player"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ SaveSlotData.SaveSlotMetadata }\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 170,
                "path": "src/saveslot/src/Shared/SaveSlotDataService.lua"
            }
        },
        {
            "name": "ObserveSlotMetadata",
            "desc": "Observes the slot metadata with the given ID for the player. Order-independent: the slot container,\nthe slot folder, and the slot's own attributes each replicate on their own schedule, so this emits\nnil until the slot is actually there, the metadata once it is, again on every attribute that lands\nafterwards, and nil again the moment the slot goes away (which is how an ephemeral slot ends).",
            "params": [
                {
                    "name": "_self",
                    "desc": "",
                    "lua_type": "SaveSlotDataService"
                },
                {
                    "name": "player",
                    "desc": "",
                    "lua_type": "Player"
                },
                {
                    "name": "slotId",
                    "desc": "",
                    "lua_type": "SaveSlotData.SlotId\n"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable.Observable<SaveSlotData.SaveSlotMetadata?>\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 189,
                "path": "src/saveslot/src/Shared/SaveSlotDataService.lua"
            }
        },
        {
            "name": "GetSlotMetadata",
            "desc": "Returns the slot metadata with the given ID for the player",
            "params": [
                {
                    "name": "_self",
                    "desc": "",
                    "lua_type": "SaveSlotDataService"
                },
                {
                    "name": "player",
                    "desc": "",
                    "lua_type": "Player"
                },
                {
                    "name": "slotId",
                    "desc": "",
                    "lua_type": "SaveSlotData.SlotId\n"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "SaveSlotData.SaveSlotMetadata?\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 216,
                "path": "src/saveslot/src/Shared/SaveSlotDataService.lua"
            }
        },
        {
            "name": "ObserveActiveSlotMetadata",
            "desc": "Observes the metadata of whichever slot is currently active, following the selection as it changes\nand emitting nil while no slot is active. This is the read a UI showing \"what am I playing right\nnow\" wants: composing [SaveSlotDataService.ObserveActiveSlotId] with\n[SaveSlotDataService.ObserveSlotMetadata] by hand is easy to get wrong, because the active-slot id\nand the slot folder it names replicate independently -- the id routinely arrives first.\n\nAn ephemeral slot is included here (it is genuinely the active slot); it is only the *list* reads\nthat exclude it.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "SaveSlotDataService"
                },
                {
                    "name": "player",
                    "desc": "",
                    "lua_type": "Player\n"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable.Observable<SaveSlotData.SaveSlotMetadata?>\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 241,
                "path": "src/saveslot/src/Shared/SaveSlotDataService.lua"
            }
        },
        {
            "name": "GetActiveSlotMetadata",
            "desc": "Returns the metadata of whichever slot is currently active, or nil when no slot is active or its\nmetadata has not replicated yet. The synchronous counterpart to\n[SaveSlotDataService.ObserveActiveSlotMetadata].",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "SaveSlotDataService"
                },
                {
                    "name": "player",
                    "desc": "",
                    "lua_type": "Player\n"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "SaveSlotData.SaveSlotMetadata?\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 261,
                "path": "src/saveslot/src/Shared/SaveSlotDataService.lua"
            }
        },
        {
            "name": "ObserveIsActiveSlotEphemeral",
            "desc": "Observes whether the active slot is an ephemeral, never-persisted one (see\n[HasSaveSlots.PromiseSelectEphemeralSlot]) -- what a UI checks before offering \"save\", \"delete\", or\nanything else that only makes sense on a real save.\n\nEmits false while the answer is not known yet (no slot active, or the slot's metadata still in\nflight) and flips to true once the slot's IsEphemeral attribute lands, so a late attribute\ndowngrades the UI rather than the reverse. Deduplicated, so it only emits on genuine changes.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "SaveSlotDataService"
                },
                {
                    "name": "player",
                    "desc": "",
                    "lua_type": "Player\n"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable.Observable<boolean>\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 281,
                "path": "src/saveslot/src/Shared/SaveSlotDataService.lua"
            }
        },
        {
            "name": "IsActiveSlotEphemeral",
            "desc": "Returns whether the active slot is an ephemeral, never-persisted one. False when no slot is active\nor its metadata has not replicated yet. The synchronous counterpart to\n[SaveSlotDataService.ObserveIsActiveSlotEphemeral].",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "SaveSlotDataService"
                },
                {
                    "name": "player",
                    "desc": "",
                    "lua_type": "Player"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 298,
                "path": "src/saveslot/src/Shared/SaveSlotDataService.lua"
            }
        },
        {
            "name": "GetSlotIdFromIndex",
            "desc": "Returns the ID for the slot at the given index",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "SaveSlotDataService"
                },
                {
                    "name": "player",
                    "desc": "",
                    "lua_type": "Player"
                },
                {
                    "name": "slotIndex",
                    "desc": "",
                    "lua_type": "number\n"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "SaveSlotData.SlotId?\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 306,
                "path": "src/saveslot/src/Shared/SaveSlotDataService.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "SaveSlotDataService",
    "desc": "",
    "source": {
        "line": 5,
        "path": "src/saveslot/src/Shared/SaveSlotDataService.lua"
    }
}