aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_base.cpp
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2020-07-18 13:53:15 +0200
committerElias Fleckenstein <eliasfleckenstein@web.de>2020-07-18 13:53:15 +0200
commitffe3c2ae0db6fed0f2b08b71bfa69f3d3df3bb1f (patch)
treecc7d9f74a43215c5d8e3965a2bfc2aea5867a7a0 /src/script/lua_api/l_base.cpp
parent45aa2516b2fc675df7049bc9ed713600c95b6423 (diff)
parent82731d0d3d8bfe9e56f89466991f13c037f3a61e (diff)
downloaddragonfireclient-ffe3c2ae0db6fed0f2b08b71bfa69f3d3df3bb1f.tar.xz
Update to minetest 5.4.0-dev
Diffstat (limited to 'src/script/lua_api/l_base.cpp')
-rw-r--r--src/script/lua_api/l_base.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/script/lua_api/l_base.cpp b/src/script/lua_api/l_base.cpp
index d507136bc..011434845 100644
--- a/src/script/lua_api/l_base.cpp
+++ b/src/script/lua_api/l_base.cpp
@@ -30,7 +30,12 @@ ScriptApiBase *ModApiBase::getScriptApiBase(lua_State *L)
{
// Get server from registry
lua_rawgeti(L, LUA_REGISTRYINDEX, CUSTOM_RIDX_SCRIPTAPI);
- ScriptApiBase *sapi_ptr = (ScriptApiBase*) lua_touserdata(L, -1);
+ ScriptApiBase *sapi_ptr;
+#if INDIRECT_SCRIPTAPI_RIDX
+ sapi_ptr = (ScriptApiBase*) *(void**)(lua_touserdata(L, -1));
+#else
+ sapi_ptr = (ScriptApiBase*) lua_touserdata(L, -1);
+#endif
lua_pop(L, 1);
return sapi_ptr;
}
@@ -40,6 +45,11 @@ Server *ModApiBase::getServer(lua_State *L)
return getScriptApiBase(L)->getServer();
}
+ServerInventoryManager *ModApiBase::getServerInventoryMgr(lua_State *L)
+{
+ return getScriptApiBase(L)->getServer()->getInventoryMgr();
+}
+
#ifndef SERVER
Client *ModApiBase::getClient(lua_State *L)
{
@@ -62,10 +72,12 @@ Environment *ModApiBase::getEnv(lua_State *L)
return getScriptApiBase(L)->getEnv();
}
+#ifndef SERVER
GUIEngine *ModApiBase::getGuiEngine(lua_State *L)
{
return getScriptApiBase(L)->getGuiEngine();
}
+#endif
std::string ModApiBase::getCurrentModPath(lua_State *L)
{