From 9493488e48c49a54e9b1ec892107735de6736c13 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Tue, 16 Aug 2016 13:02:08 +0200 Subject: cLuaState: Added direct support for pushing a nil constant. --- src/Bindings/LuaState.cpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'src/Bindings/LuaState.cpp') diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp index b5832802d..2e1415519 100644 --- a/src/Bindings/LuaState.cpp +++ b/src/Bindings/LuaState.cpp @@ -42,6 +42,7 @@ extern "C" const cLuaState::cRet cLuaState::Return = {}; +const cLuaState::cNil cLuaState::Nil = {}; /** Each Lua state stores a pointer to its creating cLuaState in Lua globals, under this name. This way any cLuaState can reference the main cLuaState's TrackedCallbacks, mutex etc. */ @@ -751,18 +752,6 @@ bool cLuaState::PushFunction(const cRef & a_TableRef, const char * a_FnName) -void cLuaState::PushNil(void) -{ - ASSERT(IsValid()); - - lua_pushnil(m_LuaState); - m_NumCurrentFunctionArgs += 1; -} - - - - - void cLuaState::Push(const AString & a_String) { ASSERT(IsValid()); @@ -860,6 +849,18 @@ void cLuaState::Push(const cItems & a_Items) +void cLuaState::Push(const cNil & a_Nil) +{ + ASSERT(IsValid()); + + lua_pushnil(m_LuaState); + m_NumCurrentFunctionArgs += 1; +} + + + + + void cLuaState::Push(const cPlayer * a_Player) { ASSERT(IsValid()); -- cgit v1.2.3