# Protocol: save

The `save` commands a program sends to a running game, as the engine describes them: what each takes, what it answers and what it does. Back to [all commands](../protocol-commands.md).

## save.list

`save.list {} -> {step: integer, place: text, slots: record}` · read, read-only

Reads the game's saves: every slot that holds something, as the scripts' save.get would read it now.

| Result | Type | Meaning |
| --- | --- | --- |
| `step` | integer | How many fixed steps have run. |
| `place` | text | Where the saves are kept: a folder. null when they are kept nowhere and end with the session, as under frost serve, frost mcp and frost run without --saves DIR. |
| `slots` | record | Each slot's name with what it holds, written as script.state writes a table. |

## save.set

`save.set {slot: text, data?: record} -> {step: integer, place: text, slots: record}` · write

Makes a slot hold a table, as a script's save.set does, or empties it. The change is written where the saves are kept. It is not input: a recording does not carry it.

| Parameters | Type | Meaning |
| --- | --- | --- |
| `slot` | text | The slot's name: 1 to 32 of a to z, the digits, `-` and `_`. |
| `data?` | record | What the slot is to hold: an object of numbers, strings, true or false, lists and objects, at most 64 KB as TOML. Left out: the slot is emptied. |

| Result | Type | Meaning |
| --- | --- | --- |
| `step` | integer | How many fixed steps have run. |
| `place` | text | Where the saves are kept: a folder. null when they are kept nowhere and end with the session, as under frost serve, frost mcp and frost run without --saves DIR. |
| `slots` | record | Each slot's name with what it holds, written as script.state writes a table. |
