Skip to content

mod.save

Keep values in the save slot. Single player, server VM.

server

The stored value, or nil. Tables come back as a copy: change it, then set it again.

Parameter Type
key string Up to 40 characters.

Returns the value or nil

if mod.is_server then
local wins = mod.save.get("wins") or 0
mod.log("wins so far:", wins)
end

server

Stores plain data with the save slot, under your mod id. Written within 30 seconds of a change and when the game closes. On the client the value only lives in memory for that session.

Parameter Type
key string Up to 40 characters.
value any Plain data, 6 levels deep, 2000 entries.

Raises

  • key must be short text
  • save.set: only plain data, 6 levels deep, 2000 entries
mod.save.set("settings", { loud = true, seen = { "intro" } })