diff options
Diffstat (limited to 'dbimport.lua')
-rw-r--r-- | dbimport.lua | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/dbimport.lua b/dbimport.lua new file mode 100644 index 0000000..22fef27 --- /dev/null +++ b/dbimport.lua @@ -0,0 +1,37 @@ + +xban.importers = { } + +dofile(xban.MP.."/importers/minetest.lua") +dofile(xban.MP.."/importers/v1.lua") + +minetest.register_chatcommand("xban_dbi", { + description = "Import old databases", + params = "<importer>", + privs = { server=true }, + func = function(name, params) + if params == "--list" then + local names = { } + for name in pairs(xban.importers) do + table.insert(names, name) + end + minetest.chat_send_player(name, + ("[xban] Known importers: %s"):format( + table.concat(names, ", "))) + return + elseif not xban.importers[params] then + minetest.chat_send_player(name, + ("[xban] Unknown importer `%s'"):format(params)) + minetest.chat_send_player(name, "[xban] Try `--list'") + return + end + local f = xban.importers[params] + local ok, err = f() + if ok then + minetest.chat_send_player(name, + "[xban] Import successfull") + else + minetest.chat_send_player(name, + ("[xban] Import failed: %s"):format(err)) + end + end, +}) |