diff options
author | madmaxoft <github@xoft.cz> | 2014-10-06 13:48:44 +0200 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2014-10-06 13:48:44 +0200 |
commit | 4e82a580602226e37aae0b1c361e71e4ce47ef52 (patch) | |
tree | 74eb0d689ab8e59e156ad3d5ebc2534f5c9af11a /src/Bindings/LuaState.cpp | |
parent | Merge pull request #1509 from WebFreak001/master (diff) | |
download | cuberite-4e82a580602226e37aae0b1c361e71e4ce47ef52.tar cuberite-4e82a580602226e37aae0b1c361e71e4ce47ef52.tar.gz cuberite-4e82a580602226e37aae0b1c361e71e4ce47ef52.tar.bz2 cuberite-4e82a580602226e37aae0b1c361e71e4ce47ef52.tar.lz cuberite-4e82a580602226e37aae0b1c361e71e4ce47ef52.tar.xz cuberite-4e82a580602226e37aae0b1c361e71e4ce47ef52.tar.zst cuberite-4e82a580602226e37aae0b1c361e71e4ce47ef52.zip |
Diffstat (limited to 'src/Bindings/LuaState.cpp')
-rw-r--r-- | src/Bindings/LuaState.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp index ba2f3c5e0..85e3f9fc5 100644 --- a/src/Bindings/LuaState.cpp +++ b/src/Bindings/LuaState.cpp @@ -861,6 +861,11 @@ void cLuaState::GetStackValue(int a_StackPos, eWeather & a_ReturnedVal) void cLuaState::GetStackValue(int a_StackPos, pBoundingBox & a_ReturnedVal) { + if (lua_isnil(m_LuaState, a_StackPos)) + { + a_ReturnedVal = NULL; + return; + } tolua_Error err; if (tolua_isusertype(m_LuaState, a_StackPos, "cBoundingBox", false, &err)) { @@ -874,6 +879,11 @@ void cLuaState::GetStackValue(int a_StackPos, pBoundingBox & a_ReturnedVal) void cLuaState::GetStackValue(int a_StackPos, pWorld & a_ReturnedVal) { + if (lua_isnil(m_LuaState, a_StackPos)) + { + a_ReturnedVal = NULL; + return; + } tolua_Error err; if (tolua_isusertype(m_LuaState, a_StackPos, "cWorld", false, &err)) { @@ -1396,10 +1406,8 @@ void cLuaState::LogStack(const char * a_Header) void cLuaState::LogStack(lua_State * a_LuaState, const char * a_Header) { - UNUSED(a_Header); // The param seems unused when compiling for release, so the compiler warns - // Format string consisting only of %s is used to appease the compiler - LOGD("%s", (a_Header != NULL) ? a_Header : "Lua C API Stack contents:"); + LOG("%s", (a_Header != NULL) ? a_Header : "Lua C API Stack contents:"); for (int i = lua_gettop(a_LuaState); i > 0; i--) { AString Value; |