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- Pick a release from subsoap/defsave releases and add its Source code (zip) URL (or a packaged
.zipasset, if the library ships one) togame.projectunder[project]dependencies, then Fetch Libraries in the Defold editor. - Run
bunx @defold-typescript/cli resolveto materialize its types. - Import it under a namespace alias of your choice:
import * as defsave from "defsave.defsave"
- Pick a release from subsoap/defsave releases and add its Source code (zip) URL (or a packaged
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:stringname:string
Returns
unknown
set(config: string, name: string, value: any)
Parameters
config:stringname:stringvalue: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