Skip to content
Download

Saving data

Save stores values by name. Writing to disk is automatic, on the same frame.

Save.set("recorde", self.pontos)
local recorde = Save.get("recorde", 0)
Save.set("inventario", { "espada", "escudo" })
local itens = Save.get("inventario", {})
Function What it does
Save.set(name, value) Stores a number, text or true/false. Lua: tables too. C++: also a std::vector of numbers or texts.
Save.get(name, default) Lua: the value as it was stored, or default.
Save.getInt(name, default) The stored integer, or default.
Save.getNumber(name, default) The stored number.
Save.getBool(name, default) The stored true/false.
Save.getText(name, default) The stored text.
Save.has(name) true if there is a value with that name.
Save.remove(name) Deletes a value.
Save.clear() Deletes everything.
  • The file is at %APPDATA%\Brasa\Jogos\<game name>\save.json, outside the game folder.
  • The game name is the one in Project settings. Changing the name starts a new file.
  • C++: lists with getInts, getNumbers and getTexts; any JSON with setJson and getJson. In C++ the functions are under Save::.
  • To pass values between rooms without writing to disk: Keep data between rooms.