dbconfig: Open sourcing our class for saving data

Hi!

We are open sourcing a small library we use for saving data on sqlite. 

Without further ado, here’s the link.

https://github.com/jeduan/corona-dbconfig

We’ve used this class on ~7 games and has worked awesome for us. We use it as a key-value store.

The API is simple. When called with 2 arguments, it saves the value. When called with 1 argument, it retrieves the value.

local dbconfig = require('vendor.dbconfig.dbconfig') dbconfig('isFirstRun', 'true') dbconfig('userName', 'John') local isFirstRun = dbconfig('isFirstRun') local userName = dbconfig('userName')

We hope it is useful for someone!

Also, check it out on Corona Code Exchange

http://code.coronalabs.com/code/dbconfig

Very nice! Thanks for sharing. What happens if you throw a table at it?

It will save the table reference, that probably isn’t of much help, however it will happily save a json.encode’d table.

We decided not to do it magically because it was a little confusing to save in a table and get back a string that the user would then have to json.decode, however if this is something enough users would like to see, I can take a look into it.

Nope please don’t worry about it. I think its great as is. I was just checking. Thanks much. 

Very nice! Thanks for sharing. What happens if you throw a table at it?

It will save the table reference, that probably isn’t of much help, however it will happily save a json.encode’d table.

We decided not to do it magically because it was a little confusing to save in a table and get back a string that the user would then have to json.decode, however if this is something enough users would like to see, I can take a look into it.

Nope please don’t worry about it. I think its great as is. I was just checking. Thanks much.