> For the complete documentation index, see [llms.txt](https://0x29a.gitbook.io/0x29a-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://0x29a.gitbook.io/0x29a-docs/data-and-platform/save.md).

# save

**data · per-program · global: `save`**

Persistent key/value storage, isolated per target program, stored at `%LOCALAPPDATA%\29a\saves\<program>.json`. Meant for script configuration (toggles, sliders, options) — see [Persistence](/0x29a-docs/introduction/persistence.md) for the distinction from [db](/0x29a-docs/data-and-platform/db.md).

Supported value types: `boolean`, `number`, `string`. Writing `nil` removes the key.

### `save.get(key [, default]) -> value`

Returns the saved value, or `default` (or `nil`) if the key was never set.

### `save.set(key, value)`

`value = nil` removes the key (equivalent to `save.delete(key)`).

### `save.delete(key)`

Alias for `save.set(key, nil)`.

### `save.all() -> table`

Returns **every** saved key as a plain Lua table.

### `save.flush()`

Forces an immediate write to disk. Normally unnecessary — every write is already debounced automatically (at most once every 2s); use this right before a critical point (e.g. just before the process closes).

### `save.program() -> string`

The current target program's identifier — this is what determines which `.json` file is being read/written.

```lua
local enabled = save.get("esp_enabled", true)
save.set("esp_enabled", not enabled)

for k, v in pairs(save.all()) do
    print(k, v)
end
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://0x29a.gitbook.io/0x29a-docs/data-and-platform/save.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
