unimportant

This commit is contained in:
uleelx 2015-04-06 21:57:17 +08:00
parent aa924bf01f
commit 73a5bfa5ba

View File

@ -19,11 +19,13 @@ local flatdb = require 'flatdb'
``` ```
1. Bind a directory as a database 1. Bind a directory as a database
```lua ```lua
local db = flatdb('./db') local db = flatdb('./db')
``` ```
2. Open or create a book 2. Open or create a book
```lua ```lua
if not db.book then if not db.book then
db.book = {} db.book = {}
@ -31,17 +33,20 @@ end
``` ```
3. Store key-value items 3. Store key-value items
```lua ```lua
db.book.key = 'value' db.book.key = 'value'
-- equivalent to db.book['key'] = 'value' -- equivalent to db.book['key'] = 'value'
``` ```
4. Retrieve items 4. Retrieve items
```lua ```lua
print(db.book.key) -- prints 'value' print(db.book.key) -- prints 'value'
``` ```
5. Save to file 5. Save to file
```lua ```lua
db:save() db:save()
-- 'book' will be saved to './db/book' -- 'book' will be saved to './db/book'