Back
· 1 min read
Save games
The save addon's save::write and save::read, and a User data dock that opens saves and prefs.
- Dragos Balaur
The library's save addon stores a table per player with save::write(slot, data), and the User data dock opens it.

- The Library dock adds the addon, and a script links it with
use addons::save::save;. fs::writewrites beside the file, syncs it and renames it over, so a crash mid-save keeps the old one.- The dock lists the game's user data folder and edits TOML and JSON files as trees.
use addons::save::save;
save::write("slot1", { "level": 4, "coins": 120 });
let data = save::read("slot1");