From e77609c5bc8b44aa22ef88063246fd05add5e705 Mon Sep 17 00:00:00 2001 From: ubq323 Date: Fri, 24 Mar 2023 21:11:10 +0000 Subject: use lmdb for world storage; plus other small things support numpad 8456 for movement in addition to wasd refactor server and add player module update outdated documentation slightly --- server/db.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 server/db.lua (limited to 'server/db.lua') diff --git a/server/db.lua b/server/db.lua new file mode 100644 index 0000000..4208aeb --- /dev/null +++ b/server/db.lua @@ -0,0 +1,15 @@ +local lmdb = require'lmdb' +local env = lmdb.open('data',{maxdbs=16}) +local function get_db(dbname, writeable) + -- shortcut + if writeable == nil then writeable = false end + local txn = assert(env:txn_begin(writeable),"couldn't begin txn") + local the_db = assert(txn:open(dbname), "couldn't open db") + return txn,the_db +end + + +return { + env=env, + get_db=get_db, +} -- cgit v1.2.3