(LuaInstance) Fixed Call() not resetting time limiter clock
Former-commit-id: 0d397fc21682f85114dc892eaea98a8f54969cde
This commit is contained in:
parent
3e16369d09
commit
23cefe1fbe
|
|
@ -149,7 +149,7 @@ class NAZARA_API NzLuaInstance : NzNonCopyable
|
||||||
static NzLuaInstance* GetInstance(lua_State* state);
|
static NzLuaInstance* GetInstance(lua_State* state);
|
||||||
|
|
||||||
private:
|
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 void* MemoryAllocator(void *ud, void *ptr, std::size_t osize, std::size_t nsize);
|
||||||
static int ProxyFunc(lua_State* state);
|
static int ProxyFunc(lua_State* state);
|
||||||
|
|
|
||||||
|
|
@ -168,12 +168,12 @@ int NzLuaInstance::ArgError(unsigned int argNum, const NzString& error)
|
||||||
|
|
||||||
bool NzLuaInstance::Call(unsigned int argCount)
|
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)
|
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
|
void NzLuaInstance::CheckAny(int index) const
|
||||||
|
|
@ -387,7 +387,7 @@ bool NzLuaInstance::Execute(const NzString& code)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Run();
|
return Run(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NzLuaInstance::ExecuteFromFile(const NzString& filePath)
|
bool NzLuaInstance::ExecuteFromFile(const NzString& filePath)
|
||||||
|
|
@ -433,7 +433,7 @@ bool NzLuaInstance::ExecuteFromStream(NzInputStream& stream)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Run();
|
return Run(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int NzLuaInstance::GetAbsIndex(int index) const
|
int NzLuaInstance::GetAbsIndex(int index) const
|
||||||
|
|
@ -830,12 +830,12 @@ NzLuaInstance* NzLuaInstance::GetInstance(lua_State* state)
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NzLuaInstance::Run()
|
bool NzLuaInstance::Run(int argCount, int resultCount)
|
||||||
{
|
{
|
||||||
if (m_level++ == 0)
|
if (m_level++ == 0)
|
||||||
m_clock.Restart();
|
m_clock.Restart();
|
||||||
|
|
||||||
int status = lua_pcall(m_state, 0, 0, 0);
|
int status = lua_pcall(m_state, argCount, resultCount, 0);
|
||||||
|
|
||||||
m_level--;
|
m_level--;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue