Added LuaInstance::Call

Former-commit-id: 3bbf04804868ab46dfcf1f9c30ad4de621c880b8
This commit is contained in:
Lynix 2015-03-24 12:50:04 +01:00
parent 36b39ec868
commit 88c3b9d482
2 changed files with 13 additions and 0 deletions

View File

@ -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;

View File

@ -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);