diff --git a/luamods/wolfadmin/db/db.lua b/luamods/wolfadmin/db/db.lua index bc8e3d9..7d6db29 100644 --- a/luamods/wolfadmin/db/db.lua +++ b/luamods/wolfadmin/db/db.lua @@ -22,21 +22,27 @@ local db = {} local con +function db.isconnected() + return (con ~= nil) +end + -- as this module serves as a wrapper/super class, we load the selected database -- system in this function. might have to think of a better way to implement -- this, but it will suffice. function db.oninit() - if settings.get("db_type") == "mysql" then - con = require (wolfa_getLuaPath()..".db.mysql") - elseif settings.get("db_type") == "sqlite3" then - con = require (wolfa_getLuaPath()..".db.sqlite3") - else - error("invalid database system (choose mysql, sqlite3)") + if settings.get("db_type") ~= "none" then + if settings.get("db_type") == "sqlite3" then + con = require (wolfa_getLuaPath()..".db.sqlite3") + elseif settings.get("db_type") == "mysql" then + con = require (wolfa_getLuaPath()..".db.mysql") + else + error("invalid database system (none|sqlite3|mysql)") + end + + setmetatable(db, {__index = con}) + + db.start() end - - setmetatable(db, {__index = con}) - - db.start() end events.handle("onGameInit", db.oninit) diff --git a/luamods/wolfadmin/util/files.lua b/luamods/wolfadmin/util/files.lua index e4d7ff4..dd9c7ba 100644 --- a/luamods/wolfadmin/util/files.lua +++ b/luamods/wolfadmin/util/files.lua @@ -68,7 +68,7 @@ function files.loadFromCFG(fileName, idExpr) table.insert(array[id], data) end - + return arrayCount, array end @@ -100,7 +100,7 @@ function files.saveToCFG(fileName, array) end et.trap_FS_FCloseFile(fileDescriptor) - + return true end diff --git a/luascripts/commands/admin/listlevels.lua b/luascripts/commands/admin/listlevels.lua new file mode 100644 index 0000000..e69de29