]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/script/lua_api/l_base.cpp
Clang-format: fix some header files and remove them from whitelist
[dragonfireclient.git] / src / script / lua_api / l_base.cpp
index 6ad3e4ba22d9183c1c63d5133cbcf4b1a5b60f88..dfe743b72cbb1510f40ff14dff3f3eef46bfcf44 100644 (file)
@@ -26,7 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 ScriptApiBase *ModApiBase::getScriptApiBase(lua_State *L)
 {
        // Get server from registry
-       lua_getfield(L, LUA_REGISTRYINDEX, "scriptapi");
+       lua_rawgeti(L, LUA_REGISTRYINDEX, CUSTOM_RIDX_SCRIPTAPI);
        ScriptApiBase *sapi_ptr = (ScriptApiBase*) lua_touserdata(L, -1);
        lua_pop(L, 1);
        return sapi_ptr;
@@ -37,6 +37,18 @@ Server *ModApiBase::getServer(lua_State *L)
        return getScriptApiBase(L)->getServer();
 }
 
+#ifndef SERVER
+Client *ModApiBase::getClient(lua_State *L)
+{
+       return getScriptApiBase(L)->getClient();
+}
+#endif
+
+IGameDef *ModApiBase::getGameDef(lua_State *L)
+{
+       return getScriptApiBase(L)->getGameDef();
+}
+
 Environment *ModApiBase::getEnv(lua_State *L)
 {
        return getScriptApiBase(L)->getEnv();
@@ -49,7 +61,7 @@ GUIEngine *ModApiBase::getGuiEngine(lua_State *L)
 
 std::string ModApiBase::getCurrentModPath(lua_State *L)
 {
-       lua_getfield(L, LUA_REGISTRYINDEX, SCRIPT_MOD_NAME_FIELD);
+       lua_rawgeti(L, LUA_REGISTRYINDEX, CUSTOM_RIDX_CURRENT_MOD_NAME);
        const char *current_mod_name = lua_tostring(L, -1);
        if (!current_mod_name)
                return ".";