> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rebind.gg/llms.txt
> Use this file to discover all available pages before exploring further.

# rb.config

> Read and write TOML files, and turn TOML text into Luau tables and back.

`rb.config` reads and writes TOML files and strings. A script reaches for it
to keep settings in a file a person can open and edit by hand.

This script loads its settings from its data folder, starts from defaults
when it cannot read the file, changes a value and saves it:

```luau theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
-- rebind: min_sdk=3.13.0 name=example version=1.0.0
local path = "@data/settings.toml"
local ok, settings = pcall(rb.config.read_toml, path)
if not ok then
  settings = rb.config.parse_toml([[
[general]
profile = "default"
sensitivity = 1.5
]])
end

settings.general.sensitivity = 2
rb.config.write_toml(path, settings)
print(rb.config.to_toml(settings))
```

| Signature | Returns |
| - | - |
| `rb.config.parse_toml(text: string) -> { [string]: any }` | |
| `rb.config.to_toml(value: { [string]: any }) -> string` | |
| `rb.config.read_toml(path: string) -> { [string]: any }` | path rules as [`rb.file`](https://docs.rebind.gg/reference/sdk/file) |
| `rb.config.write_toml(path: string, value: { [string]: any }) -> ()` | |

`write_toml` follows the same path rules, and `read_toml` and `write_toml`
both take [`@data/` paths](https://docs.rebind.gg/reference/sdk/file). `read_toml` raises when the file is
missing, and `parse_toml` and `read_toml` raise on text that is not valid TOML.

TOML dates read as strings. A whole number writes as a TOML integer. A `nil`
value, a function, or another type TOML cannot hold raises.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.