unimportant
This commit is contained in:
parent
aa924bf01f
commit
73a5bfa5ba
@ -19,11 +19,13 @@ local flatdb = require 'flatdb'
|
||||
```
|
||||
|
||||
1. Bind a directory as a database
|
||||
|
||||
```lua
|
||||
local db = flatdb('./db')
|
||||
```
|
||||
|
||||
2. Open or create a book
|
||||
|
||||
```lua
|
||||
if not db.book then
|
||||
db.book = {}
|
||||
@ -31,17 +33,20 @@ end
|
||||
```
|
||||
|
||||
3. Store key-value items
|
||||
|
||||
```lua
|
||||
db.book.key = 'value'
|
||||
-- equivalent to db.book['key'] = 'value'
|
||||
```
|
||||
|
||||
4. Retrieve items
|
||||
|
||||
```lua
|
||||
print(db.book.key) -- prints 'value'
|
||||
```
|
||||
|
||||
5. Save to file
|
||||
|
||||
```lua
|
||||
db:save()
|
||||
-- 'book' will be saved to './db/book'
|
||||
|
Loading…
Reference in New Issue
Block a user