diff --git a/include/Nazara/Lua/LuaInstance.hpp b/include/Nazara/Lua/LuaInstance.hpp index f694c2fe7..b959b61db 100644 --- a/include/Nazara/Lua/LuaInstance.hpp +++ b/include/Nazara/Lua/LuaInstance.hpp @@ -35,6 +35,9 @@ class NAZARA_API NzLuaInstance : NzNonCopyable int ArgError(unsigned int argNum, const char* error); int ArgError(unsigned int argNum, const NzString& error); + bool Call(unsigned int argCount); + bool Call(unsigned int argCount, unsigned int resultCount); + void CheckAny(int index) const; bool CheckBoolean(int index) const; bool CheckBoolean(int index, bool defValue) const; diff --git a/src/Nazara/Lua/LuaInstance.cpp b/src/Nazara/Lua/LuaInstance.cpp index c1e1fa875..710e039e2 100644 --- a/src/Nazara/Lua/LuaInstance.cpp +++ b/src/Nazara/Lua/LuaInstance.cpp @@ -159,6 +159,16 @@ int NzLuaInstance::ArgError(unsigned int argNum, const NzString& error) return luaL_argerror(m_state, argNum, error.GetConstBuffer()); } +bool NzLuaInstance::Call(unsigned int argCount) +{ + return lua_pcall(m_state, argCount, LUA_MULTRET, 0) == LUA_OK; +} + +bool NzLuaInstance::Call(unsigned int argCount, unsigned int resultCount) +{ + return lua_pcall(m_state, argCount, resultCount, 0) == LUA_OK; +} + void NzLuaInstance::CheckAny(int index) const { luaL_checkany(m_state, index);