Skip to main content

Function: saveGame()

saveGame(slot, gameData, options): Promise<number>

Defined in: packages/core/src/saves/db.ts:120

Save game data to the database

Parameters​

slot​

Slot the save occupies (e.g., a slot number or custom key)

string | number

gameData​

Record<string, unknown>

Game state data to save

options​

SaveOptions & object = {}

Player-facing annotations and, for restores, the version to stamp the save with. version defaults to the current game version; pass the original when restoring a save created by an older build, otherwise migrations will never run for it.

Returns​

Promise<number>

Promise - The ID of the save