Save data
Look up save data calls and properties.
save.get(key) [BETA]
Read a saved value.
- Arguments
key: string.- Returns
number, bool, string, or nil when missing.
- Works with
The current project save slot.
- Missing values and errors
A missing key returns nil. Wrong argument counts or types report an error.
One default slot is supported. Set and remove stage changes; only commit writes them. Save data does not change the authored project.
debug.log(save.get("visits"))save.set(key, value) [BETA]
Stage a save value in memory.
- Arguments
key: string.value: number, bool, or string.- Returns
nil.
- Works with
The current project save slot.
- Missing values and errors
Only number, bool, and string values are supported. Wrong argument counts or types report an error.
One default slot is supported. Set and remove stage changes; only commit writes them. Save data does not change the authored project.
save.set("visits", 1)
save.commit()save.has(key) [BETA]
Check whether a save key exists.
- Arguments
key: string.- Returns
bool.
- Works with
The current project save slot.
- Missing values and errors
A missing key returns false. Wrong argument counts or types report an error.
One default slot is supported. Set and remove stage changes; only commit writes them. Save data does not change the authored project.
debug.log(save.has("visits"))save.remove(key) [BETA]
Stage removal of a save key.
- Arguments
key: string.- Returns
Whether a value was removed.
- Works with
The current project save slot.
- Missing values and errors
A missing key returns false. Wrong argument counts or types report an error.
One default slot is supported. Set and remove stage changes; only commit writes them. Save data does not change the authored project.
save.remove("visits")
save.commit()save.commit() [BETA]
Write staged save changes to disk.
- Arguments
No arguments.
- Returns
nil on success.
- Works with
The current project save slot.
- Missing values and errors
Disk failures and unsupported newer save formats report an error. Wrong argument counts or types report an error.
One default slot is supported. Set and remove stage changes; only commit writes them. Save data does not change the authored project.
save.set("tutorial_complete", true)
save.commit()[BETA] marks features newer than the current public release. Current release: 0.8.0.