On this page

subsoap/defsave/defsave.defsave

Save and load config and user data persistently between a Defold project's sessions

  • GitHub: subsoap/defsave — pinned to 2fe3aed
    1. Pick a release from subsoap/defsave releases and add its Source code (zip) URL (or a packaged .zip asset, if the library ships one) to game.project under [project] dependencies, then Fetch Libraries in the Defold editor.
    2. Run bunx @defold-typescript/cli resolve to materialize its types.
    3. Import it under a namespace alias of your choice:
      import * as defsave from "defsave.defsave"

Functions

set_appname(name: string)

Parameters

  • name: string

load(config: string): unknown

Parameters

  • config: string

Returns

  • unknown

get(config: string, name: string): unknown

Parameters

  • config: string
  • name: string

Returns

  • unknown

set(config: string, name: string, value: any)

Parameters

  • config: string
  • name: string
  • value: any

save(config: string)

Parameters

  • config: string

save_all(all_files?: boolean)

You can save all files at once. By default, it will only actually save files with changes, but you can force saving all files by setting the force flag to true.

Parameters

  • all_files?: boolean — false only saves changed files and true saves all files

update(dt: number)

In your update, if you want autosave to be enabled, you will need to include

Parameters

  • dt: number

Variables

appname: string