Aaron Suen 79324d4aa0 Replace exportdb with configdb
- Open up room for potential for more config
  options (which properties to export, additional
  indirectly-depended media, etc).
- Restructure API to use items as well.  For now,
  I am assuming there are no legacy applications
  that need to be supported so the old methods
  are immediately removed; may be re-added
  if compat turns out to be needed.
2022-11-27 09:36:52 -05:00

32 lines
732 B
Lua

-- LUALOCALS < ---------------------------------------------------------
local minetest, pairs, rawget, rawset
= minetest, pairs, rawget, rawset
-- LUALOCALS > ---------------------------------------------------------
local include = ...
local modname = minetest.get_current_modname()
local api = rawget(_G, modname) or {}
rawset(_G, modname, api)
local configdb, savedb = include("configdb")
local exportall = include("exportall")
function api.item_get_all()
local t = {}
for k in pairs(configdb.items) do t[k] = true end
return t
end
function api.item_get(k) return configdb.items[k] end
function api.item_set(k, v)
configdb.items[k] = v and true or nil
end
function api.export()
savedb()
return exportall()
end