{"id":16085297,"url":"https://github.com/subsoap/defsave","last_synced_at":"2025-04-12T20:06:27.368Z","repository":{"id":27185544,"uuid":"111611744","full_name":"subsoap/defsave","owner":"subsoap","description":"Save and load config and user data persistently between a Defold project's sessions","archived":false,"fork":false,"pushed_at":"2024-03-26T01:00:50.000Z","size":54,"stargazers_count":86,"open_issues_count":7,"forks_count":10,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-12T20:06:17.681Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/subsoap.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-11-21T23:10:30.000Z","updated_at":"2025-04-11T20:53:32.000Z","dependencies_parsed_at":"2022-07-18T12:31:47.653Z","dependency_job_id":"f2bf484c-6464-4370-9db2-560f7a5426e5","html_url":"https://github.com/subsoap/defsave","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/subsoap%2Fdefsave","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/subsoap%2Fdefsave/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/subsoap%2Fdefsave/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/subsoap%2Fdefsave/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/subsoap","download_url":"https://codeload.github.com/subsoap/defsave/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248625493,"owners_count":21135513,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-09T13:01:54.589Z","updated_at":"2025-04-12T20:06:27.332Z","avatar_url":"https://github.com/subsoap.png","language":"Lua","funding_links":[],"categories":["Libraries"],"sub_categories":["Programming Language"],"readme":"# DefSave\nA module to help you save / load config and player data in your Defold projects between sessions\n\n## Installation\nYou can use DefSave in your own project by adding this project as a [Defold library dependency](http://www.defold.com/manuals/libraries/). Open your game.project file and in the dependencies field under project add:\n\n\thttps://github.com/subsoap/defsave/archive/master.zip\n\nOnce added, you must require the main Lua module in scripts via\n\n```\nlocal defsave = require(\"defsave.defsave\")\n```\n\n## Usage\n\nFirst set your game's appname\n\n```\ndefsave.appname = \"my_awesome_game\"\n```\n\nLoad a file\n\n```\ndefsave.load(\"config\")\n```\n\nGet a key from a loaded file\n\n```\ndefsave.get(\"config\", \"audio\")\n```\n\nSet a key to a loaded file\n\n```\ndefsave.set(\"config\", \"fullscreen\", false)\n```\n\nSave a file\n\n```\ndefsave.save(\"config\")\n```\n\nYou 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.\n\n```\ndefsave.save_all() -- only saves changed files\n```\n```\ndefsave.save_all(true) -- saves all files\n```\n\nIn your update, if you want autosave to be enabled, you will need to include\n\n```\ndefsave.update(dt)\n```\n\nTo save all files on the ending of your game you need to include in final\n\n```\ndefsave.save_all()\n```\n\nYou can setup template defaults for your files too. These are used if you set defsave.use_default_data to true which is true by default. While use_default_data is true defsave will check the defsave.default_data table to see if there is any default data there when a file is loaded which is empty. Check the example for an example of default_data.lua and how it can be set.\n\n## Information\n\nDon't include an extension in your file names. Use \"config\" over \"config.dat\" for example.\n\nDon't name your filenames with a leading number or any character not allowed in Lua variable names. Use \"profile_1\" not \"1\" for example.\n\nBy default, the contents of the saved files are not encrypted, but support for this is coming soon.\n\nSet verbose to true to also print any successful messages, otherwise only errors or warnings will be printed.\n\n## Save Locations\n\nIf you need to backup or clear your save data you can find it in:\n\n**Windows**\n\u003e%appdata%\\Roaming\\appname\\filename\n\n**OS X**\n\u003e~/Library/Application Support/appname/filename\n\n**Linux** (default path is slightly modified to be within .config user folder)\n\u003e~/.config/appname/filename\n\n**iOS**\n\u003e/var/mobile/Containers/Data/Application/{app-uid?}/Library/Application Support/appname/filename\n\n**Android**\n\u003e/data/data/com.packagename/files/filename\n\n**HTML5**\n\nUses [`localStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage), under item named `\"appname_filename\"`.\n\nThe appname is based on the function for getting the path sys.get_save_file(\"appname\", \"filename\") by default DefSave saves in the OS appropriate location and not next to the binary.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsubsoap%2Fdefsave","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsubsoap%2Fdefsave","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsubsoap%2Fdefsave/lists"}