From 964647a9006af475bea71272e313f3575cf4d37f Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 20 Mar 2014 09:16:47 +0100 Subject: [PATCH] Made pushing plain pointer to Lua a valid operation, with a warning. This is used for exotic explosions, and the NORETURNDEBUG macro caused MSVC warnings across the entire cLuaState class (MSVC marked ALL Push() function overloads as non-returning) --- src/Bindings/LuaState.cpp | 5 +++-- src/Bindings/LuaState.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp index 0bb047873..47380b8a7 100644 --- a/src/Bindings/LuaState.cpp +++ b/src/Bindings/LuaState.cpp @@ -689,9 +689,10 @@ void cLuaState::Push(void * a_Ptr) ASSERT(IsValid()); // Investigate the cause of this - what is the callstack? - LOGWARNING("Lua engine encountered an error - attempting to push a plain pointer"); + // One code path leading here is the OnHookExploding / OnHookExploded with exotic parameters. Need to decide what to do with them + LOGWARNING("Lua engine: attempting to push a plain pointer, pushing nil instead."); + LOGWARNING("This indicates an unimplemented part of MCS bindings"); LogStackTrace(); - ASSERT(!"A plain pointer should never be pushed on Lua stack"); lua_pushnil(m_LuaState); m_NumCurrentFunctionArgs += 1; diff --git a/src/Bindings/LuaState.h b/src/Bindings/LuaState.h index 356a284e0..f0047b362 100644 --- a/src/Bindings/LuaState.h +++ b/src/Bindings/LuaState.h @@ -200,7 +200,7 @@ public: void Push(const HTTPTemplateRequest * a_Request); void Push(cTNTEntity * a_TNTEntity); void Push(Vector3i * a_Vector); - NORETURNDEBUG void Push(void * a_Ptr); + void Push(void * a_Ptr); void Push(cHopperEntity * a_Hopper); void Push(cBlockEntity * a_BlockEntity);