Skip to content

Search

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.

The library's save addon stores a table per player with save::write(slot, data), and the User data dock opens it.

The User data dock with the prefs slot open

  • The Library dock adds the addon, and a script links it with use addons::save::save;.
  • fs::write writes 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");

Shipping: save games

Are you sure?