[MUDLET] Databases

KlendathuKlendathu Eye of the Storm
I've decided to learn how to use databases for Mudlet, so am starting with a relatively simple idea, a way to store shrine locations. I've created the database (I can see the relevant file in my profile folder), but am encountering an error when I try to db:fetch...

kln		= kln or {}
kln.db = kln.db or {}
db:create("klndb", {shrines={"divine","roomNum"}}) -- database is created
local klndb = db:get_database("klndb") -- assign database to variable name
kln.db.testAdd = function()
db:add(klndb.shrines,{divine="test",roomNum=1234})
end
kln.db.testShow = function()
display(db.fetch(klndb.shrines))
end

I don't get an error when running kln.db.testAdd() but when I try to run kln.db.testShow(), it returns the following error:

<mudlet-lua/lua/DB.lua:848: attempt to index local 'sheet' (a nil value)>

It returns the same error whether or not I'm using display(). I'm sure I've missed something trivial, but I'm falling at the first hurdle!


Tharos, the Announcer of Delos shouts, "It's near the end of the egghunt and I still haven't figured out how to pronounce Clean-dat-hoo."

Comments

Sign In or Register to comment.