79324d4aa0
- 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.
32 lines
732 B
Lua
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
|