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!
Comments
GMCP documentation: https://github.com/keneanung/GMCPAdditions
svof github site: https://github.com/svof/svof and documentation at https://svof.github.io/svof
Can a database be created in a different folder than the profile folder? If so, how? I've tried adding the path in the db:create line to no avail.
Excerpt from that function:
GMCP documentation: https://github.com/keneanung/GMCPAdditions
svof github site: https://github.com/svof/svof and documentation at https://svof.github.io/svof
Thanks both, back to my musings