Skip to content

luxe API (2025.1.2)


luxe: save module


Save

import "luxe: save" for Save

A cross platform save system with a Key/Value store and file storage for a user, and save slots.

  //create a new save profile. loads the default save slot for single save use
  var save = Save.create("organization", "game")
  
  //OR

  //create a new slot and set it as the active save slot 
  Save.new_slot(save)
  
  //OR

  //Load a save slot from e.g Save.list()
  var list = Save.list(save)
  //activate the first slot
  Save.set_slot(save, list[0])

  
  //Set some slot specific values
  Save.set(save, "key", "value")
  //Set some user specific values
  Save.set(save, "key", "value", SaveScope.user)

  //Get some values from the slot
  var name = Save.get(save, "name", "default_name")
  //get user values, like settings
  var setting = Save.get(save, "setting", false, SaveScope.user)
  • create(org: String, app: String)
  • create(org: String, app: String, user_id: String)
  • save(save: Save)
  • new_slot(save: Save)
  • set_slot(save: Save, slot: String)
  • list(save: Save)
  • file_exists(save: Save, file_id: String)
  • file_exists(save: Save, file_id: String, kind: SaveScope)
  • set_file(save: Save, file_id: String, file_contents: String)
  • set_file(save: Save, file_id: String, file_contents: String, kind: SaveScope)
  • get_file(save: Save, file_id: String)
  • get_file(save: Save, file_id: String, kind: SaveScope)
  • set(save: Save, key: String, value: Any)
  • set(save: Save, key: String, value: Any, kind: SaveScope)
  • get(save: Save, key: String, default: Any)
  • get(save: Save, key: String, default: Any, kind: SaveScope)
  • has(save: Save, key: String)
  • has(save: Save, key: String, kind: SaveScope)
  • get_keys(save: Save)
  • get_keys(save: Save, kind: SaveScope)
  • slot_clear(save: Save, slot: String)
  • slot_backup(save: Save, slot: String)
  • slot_modified_time(save: Save, slot: String)
  • slot_file_exists(save: Save, slot: String, file_id: String)
  • slot_set_file(save: Save, slot: String, file_id: String, file_contents: String)
  • slot_get_file(save: Save, slot: String, file_id: String)

Save.create(org: String, app: String) returns Save

Create a save slot for the given organization/app name pair. Defaults to 'user' for user id

Save.create(org: String, app: String, user_id: String) returns Save

Create a save slot for the given user and organization/app name pair. e.g If you have a steam user ID, you'd pass it in here as a string.

Save.save(save: Save) returns unknown

Flush the data for this profile to storage. Unless auto save on key change is off, unnecessary

Save.new_slot(save: Save) returns None

Set the current active save slot to a new slot ID.

Save.set_slot(save: Save, slot: String) returns unknown

Set the current active save slot to a Slot ID (from Save.list or otherwise).

Save.list(save: Save) returns unknown

Return a list of save slot uuids for use with the slot query apis, sorted by modified time (latest first)

Save.file_exists(save: Save, file_id: String) returns unknown

Returns true if the given file path can be found for the active save slot

Save.file_exists(save: Save, file_id: String, kind: SaveScope) returns unknown

Returns true if the given file path can be found

Save.set_file(save: Save, file_id: String, file_contents: String) returns unknown

Save the contents of a file at the given path for the active save slot. The path is a relative style path, like some/file/here

Save.set_file(save: Save, file_id: String, file_contents: String, kind: SaveScope) returns unknown

Save the contents of a file at the given path. The path is a relative style path, like some/file/here

Save.get_file(save: Save, file_id: String) returns unknown

Return the contents of the file with the given path for the active save slot. If not found, returns null

Save.get_file(save: Save, file_id: String, kind: SaveScope) returns unknown

Return the contents of the file with the given path. If not found, returns null

Save.set(save: Save, key: String, value: Any) returns unknown

Set the value for a key to the given value, for the active save slot

Save.set(save: Save, key: String, value: Any, kind: SaveScope) returns unknown

Set the value for a key to the given value

Save.get(save: Save, key: String, default: Any) returns unknown

Returns the value for the given key if found, otherwise returns the default provided, for the active save slot

Save.get(save: Save, key: String, default: Any, kind: SaveScope) returns unknown

Returns the value for the given key if found, otherwise returns the default provided

Save.has(save: Save, key: String) returns unknown

Returns true if the given key can be found, for the active save slot

Save.has(save: Save, key: String, kind: SaveScope) returns unknown

Returns true if the given key can be found

Save.get_keys(save: Save) returns unknown

Returns a list of knowns keys, for the active save slot

Save.get_keys(save: Save, kind: SaveScope) returns unknown

Returns a list of knowns keys

Save.slot_clear(save: Save, slot: String) returns Bool

Slot query. Delete a save slot, return true or false for success

Save.slot_backup(save: Save, slot: String) returns String

Slot query. Makes a backup of the slot, returns a slot ID of the backup if successful, null if false

Save.slot_modified_time(save: Save, slot: String) returns unknown

Slot query. Returns the modified time for the given save slot ID

Save.slot_file_exists(save: Save, slot: String, file_id: String) returns unknown

Slot query. Returns true if the given file path can be found for the given save slot ID

Save.slot_set_file(save: Save, slot: String, file_id: String, file_contents: String) returns unknown

Slot query. Save the contents of a file at the given path for the given slot ID. The path is a relative style path, like some/file/here

Save.slot_get_file(save: Save, slot: String, file_id: String) returns unknown

Slot query. Return the contents of the file with the given path for the given slot ID. If not found, returns null

SaveScope

import "luxe: save" for SaveScope

no docs found


SaveScope.slot returns unknown

no docs found

SaveScope.user returns unknown

no docs found