module

SaveGame

Constants

DEFAULT_DIR = "saves"
DEFAULT_SLOT = "autosave"

Class methods

load(path : String) : GameState | String

Load game state from disk. Returns the restored state, or a String error.

Source
resolve_path(arg : String | Nil) : String

Resolve a user-supplied save argument to a filesystem path.

  • nil / blank โ†’ saves/autosave.json
  • "hero1" โ†’ saves/hero1.json (sanitized)
  • "foo.json" or "path/to/file" โ†’ used as a path literally
Source
save(state : GameState, path : String) : String

Write game state to disk. Creates parent directories as needed. Returns a human-readable success or error message.

Source