SaveSlotExportUtils
Pure helpers describing an exported save slot and the main-slot guard that keeps export/import away from the player's shared root datastore. See HasSaveSlots.PromiseExportSlot and HasSaveSlots.PromiseImportSlot.
Types
SaveSlotExportKind
interface SaveSlotExportKind {CODE: "code"--
a share code, redeemable into a slot the owner keeps
TRANSFER: "transfer"--
a live snapshot carried across a teleport, loadable from a client-presented key
}What an entry in the shared store may be loaded as.
The two exist because one of the shared store's readers takes its key from the client: a teleport arrives carrying the key of the transferable ephemeral slot it is resuming, and the arrival path loads whatever is behind it. A share code handed to a friend must not be loadable that way, so the writer records which of the two it wrote and each reader accepts only its own kind.
Functions
isMainSlotIndex
SaveSlotExportUtils.isMainSlotIndex(slotIndex: number) → booleanReturns whether the given index is the main/default slot -- the one whose store is the player's shared root datastore (it shares that key with the SaveSlots system data and universe-scoped global data). Export/import refuse this index in both directions.
isSaveSlotExport
SaveSlotExportUtils.isSaveSlotExport(value: any) → booleanReturns whether the value is a well-formed [SaveSlotExport].
canLoadAs
Returns whether an entry read from the shared store may be loaded as the given kind.
Entries written before kinds existed carry none, and are treated as share codes: back then the transfer path re-saved under the very key the code was minted as, so an untagged entry is indistinguishable from the code it started life as. Old codes therefore keep working, while the arrival path -- the one reading a client-presented key -- accepts nothing that was not explicitly written as a transfer.
withKind
Returns a copy of the export tagged as the given kind, for writing to the shared store.
create
SaveSlotExportUtils.create(data: {[string]: any},slotName: string?,summary: any?,timePlayed: number?--
the source slot's accrued playtime, in seconds
) → SaveSlotExportBuilds a [SaveSlotExport] from a slot's data table and its metadata.