(LuaInstance) Fixed Call() not resetting time limiter clock

Former-commit-id: 0d397fc21682f85114dc892eaea98a8f54969cde
This commit is contained in:
Lynix 2015-03-28 14:45:21 +01:00
parent 3e16369d09
commit 23cefe1fbe
2 changed files with 7 additions and 7 deletions

View File

@ -149,7 +149,7 @@ class NAZARA_API NzLuaInstance : NzNonCopyable
static NzLuaInstance* GetInstance(lua_State* state);
private:
bool Run();
bool Run(int argCount, int resultCount);
static void* MemoryAllocator(void *ud, void *ptr, std::size_t osize, std::size_t nsize);
static int ProxyFunc(lua_State* state);

View File

@ -168,12 +168,12 @@ int NzLuaInstance::ArgError(unsigned int argNum, const NzString& error)
bool NzLuaInstance::Call(unsigned int argCount)
{
return lua_pcall(m_state, argCount, LUA_MULTRET, 0) == LUA_OK;
return Run(argCount, LUA_MULTRET);
}
bool NzLuaInstance::Call(unsigned int argCount, unsigned int resultCount)
{
return lua_pcall(m_state, argCount, resultCount, 0) == LUA_OK;
return Run(argCount, resultCount);
}
void NzLuaInstance::CheckAny(int index) const
@ -387,7 +387,7 @@ bool NzLuaInstance::Execute(const NzString& code)
return false;
}
return Run();
return Run(0, 0);
}
bool NzLuaInstance::ExecuteFromFile(const NzString& filePath)
@ -433,7 +433,7 @@ bool NzLuaInstance::ExecuteFromStream(NzInputStream& stream)
return false;
}
return Run();
return Run(0, 0);
}
int NzLuaInstance::GetAbsIndex(int index) const
@ -830,12 +830,12 @@ NzLuaInstance* NzLuaInstance::GetInstance(lua_State* state)
return instance;
}
bool NzLuaInstance::Run()
bool NzLuaInstance::Run(int argCount, int resultCount)
{
if (m_level++ == 0)
m_clock.Restart();
int status = lua_pcall(m_state, 0, 0, 0);
int status = lua_pcall(m_state, argCount, resultCount, 0);
m_level--;