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.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/Bindings/LuaState.h') diff --git a/src/Bindings/LuaState.h b/src/Bindings/LuaState.h index 303a59327..3c07ac5d2 100644 --- a/src/Bindings/LuaState.h +++ b/src/Bindings/LuaState.h @@ -327,14 +327,21 @@ public: T & m_Dest; }; + /** A dummy class that's used only to delimit function args from return values for cLuaState::Call() */ class cRet { } ; - static const cRet Return; // Use this constant to delimit function args from return values for cLuaState::Call() + /** A dummy class that's used only to push a constant nil as a function parameter in Call(). */ + class cNil + { + }; + static const cNil Nil; // Use this constant to give a function a nil parameter in Call() + + /** A RAII class for values pushed onto the Lua stack. Will pop the value off the stack in the destructor. */ class cStackValue @@ -489,8 +496,6 @@ public: Push(std::forward(a_Arg2), std::forward(a_Args)...); } - void PushNil(void); - // Push a const value onto the stack (keep alpha-sorted): void Push(const AString & a_String); void Push(const AStringMap & a_Dictionary); @@ -499,6 +504,7 @@ public: void Push(const cCraftingRecipe * a_Recipe); void Push(const char * a_Value); void Push(const cItems & a_Items); + void Push(const cNil & a_Nil); void Push(const cPlayer * a_Player); void Push(const cRef & a_Ref); void Push(const HTTPRequest * a_Request); -- cgit v1.2.3