Minor changes

Former-commit-id: 03920c74e2dc63a700d8167318d1bb14b4b68c8d
This commit is contained in:
Lynix 2013-05-01 01:37:18 +02:00
parent ce358b119f
commit 2097d3476d
2 changed files with 5 additions and 20 deletions

View File

@ -92,7 +92,7 @@ class NAZARA_API NzLuaInstance : NzNonCopyable
void Pop(unsigned int n = 1U); void Pop(unsigned int n = 1U);
void PushBoolean(bool value); void PushBoolean(bool value);
void PushCFunction(NzLuaCFunction func, int valueCount = 0); void PushCFunction(NzLuaCFunction func, int upvalueCount = 0);
void PushFunction(NzLuaFunction func); void PushFunction(NzLuaFunction func);
void PushInteger(int value); void PushInteger(int value);
void PushLightUserdata(void* value); void PushLightUserdata(void* value);

View File

@ -224,22 +224,7 @@ bool NzLuaInstance::Execute(const NzString& code)
return false; return false;
} }
if (m_level++ == 0) return Run();
m_clock.Restart();
int status = lua_pcall(m_state, 0, LUA_MULTRET, 0);
m_level--;
if (status != 0)
{
m_lastError = lua_tostring(m_state, -1);
lua_pop(m_state, 1);
return false;
}
return true;
} }
bool NzLuaInstance::ExecuteFromFile(const NzString& filePath) bool NzLuaInstance::ExecuteFromFile(const NzString& filePath)
@ -278,7 +263,7 @@ bool NzLuaInstance::ExecuteFromStream(NzInputStream& stream)
StreamData data; StreamData data;
data.stream = &stream; data.stream = &stream;
if (lua_load(m_state, StreamReader, &data, "C", nullptr) != 0) if (lua_load(m_state, StreamReader, &data, "C++", nullptr) != 0)
{ {
m_lastError = lua_tostring(m_state, -1); m_lastError = lua_tostring(m_state, -1);
lua_pop(m_state, 1); lua_pop(m_state, 1);
@ -511,9 +496,9 @@ void NzLuaInstance::PushBoolean(bool value)
lua_pushboolean(m_state, value); lua_pushboolean(m_state, value);
} }
void NzLuaInstance::PushCFunction(NzLuaCFunction func, int valueCount) void NzLuaInstance::PushCFunction(NzLuaCFunction func, int upvalueCount)
{ {
lua_pushcclosure(m_state, func, valueCount); lua_pushcclosure(m_state, func, upvalueCount);
} }
void NzLuaInstance::PushFunction(NzLuaFunction func) void NzLuaInstance::PushFunction(NzLuaFunction func)