diff options
author | Mattes D <github@xoft.cz> | 2016-08-11 21:04:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-11 21:04:29 +0200 |
commit | c4578db4dfc520a4267992778912135970c8cf0e (patch) | |
tree | a1cc91a8f61b718855034bea03f1a01080f69561 /src | |
parent | Updated Core. (diff) | |
download | cuberite-c4578db4dfc520a4267992778912135970c8cf0e.tar cuberite-c4578db4dfc520a4267992778912135970c8cf0e.tar.gz cuberite-c4578db4dfc520a4267992778912135970c8cf0e.tar.bz2 cuberite-c4578db4dfc520a4267992778912135970c8cf0e.tar.lz cuberite-c4578db4dfc520a4267992778912135970c8cf0e.tar.xz cuberite-c4578db4dfc520a4267992778912135970c8cf0e.tar.zst cuberite-c4578db4dfc520a4267992778912135970c8cf0e.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Bindings/LuaState.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp index b399f9659..12afeac5c 100644 --- a/src/Bindings/LuaState.cpp +++ b/src/Bindings/LuaState.cpp @@ -319,12 +319,30 @@ void cLuaState::Create(void) void cLuaState::RegisterAPILibs(void) { + auto top = lua_gettop(m_LuaState); tolua_AllToLua_open(m_LuaState); + ASSERT(top == lua_gettop(m_LuaState)); cManualBindings::Bind(m_LuaState); + ASSERT(top == lua_gettop(m_LuaState)); DeprecatedBindings::Bind(m_LuaState); + ASSERT(top == lua_gettop(m_LuaState)); cLuaJson::Bind(*this); + ASSERT(top == lua_gettop(m_LuaState)); luaopen_lsqlite3(m_LuaState); + if (top == lua_gettop(m_LuaState) - 1) + { + // lsqlite3 left the "sqlite3" table on the stack, pop it: + lua_pop(m_LuaState, 1); + } + ASSERT(top == lua_gettop(m_LuaState)); luaopen_lxp(m_LuaState); + this->LogStackValues("After lxp"); + if (top == lua_gettop(m_LuaState) - 1) + { + // lxp left the unregistered "lxp" table on the stack, register and pop it (#3304): + lua_setglobal(m_LuaState, "lxp"); + } + ASSERT(top == lua_gettop(m_LuaState)); } @@ -428,7 +446,6 @@ void cLuaState::AddPackagePath(const AString & a_PathVariable, const AString & a lua_pop(m_LuaState, 1); // Stk: <package> lua_pushlstring(m_LuaState, NewPackagePath.c_str(), NewPackagePath.length()); // Stk: <package> <NewPackagePath> lua_setfield(m_LuaState, -2, a_PathVariable.c_str()); // Stk: <package> - lua_pop(m_LuaState, 1); lua_pop(m_LuaState, 1); // Stk: - } |