Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/qeffects/love-simple-storage
Simple storage for love2d
https://github.com/qeffects/love-simple-storage
Last synced: 28 days ago
JSON representation
Simple storage for love2d
- Host: GitHub
- URL: https://github.com/qeffects/love-simple-storage
- Owner: qeffects
- License: mit
- Created: 2022-01-04T17:34:50.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-01-04T20:51:58.000Z (almost 3 years ago)
- Last Synced: 2024-04-28T23:25:07.071Z (8 months ago)
- Language: TypeScript
- Size: 34.2 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# A simple persistent storage model for love
[![Tests](https://github.com/qeffects/love-simple-storage/actions/workflows/node.js.yml/badge.svg)](https://github.com/qeffects/love-simple-storage/actions/workflows/node.js.yml)
(the files aren't human readable)
Requires love > 11.4
usage:
```lua
local simpleStorage = require('simpleStorage')local foo = simpleStorage.getField('foo', false)
if foo then
print('hello world')
else
simpleStorage.setField('foo', true)
end
```functions:
`getField(fieldName, defaultValue)`
gets a value at a field, if it doesn't exist returns defaultValue
`setField(fieldName, value)`
sets a field to a value
Optionally set the file handle before the first require like so:
```lua
SIMPLE_STORAGE_FILE = 'foo.storage'
local simpleStorage = require('simpleStorage')
```Mind that setField will write the file to the disk.
Available in NPM as a typescript to lua ready library:
https://www.npmjs.com/package/love-simple-storage
or as a bundled lua only library: https://github.com/qeffects/love-simple-storage/suites/4831790610/artifacts/136621514