diff --git a/include/Nazara/Lua/LuaInstance.hpp b/include/Nazara/Lua/LuaInstance.hpp index 375607c8f..e80b57997 100644 --- a/include/Nazara/Lua/LuaInstance.hpp +++ b/include/Nazara/Lua/LuaInstance.hpp @@ -92,7 +92,7 @@ class NAZARA_API NzLuaInstance : NzNonCopyable void Pop(unsigned int n = 1U); void PushBoolean(bool value); - void PushCFunction(NzLuaCFunction func, int valueCount = 0); + void PushCFunction(NzLuaCFunction func, int upvalueCount = 0); void PushFunction(NzLuaFunction func); void PushInteger(int value); void PushLightUserdata(void* value); diff --git a/src/Nazara/Lua/LuaInstance.cpp b/src/Nazara/Lua/LuaInstance.cpp index 2144e3c37..c3146dfa1 100644 --- a/src/Nazara/Lua/LuaInstance.cpp +++ b/src/Nazara/Lua/LuaInstance.cpp @@ -224,22 +224,7 @@ bool NzLuaInstance::Execute(const NzString& code) return false; } - if (m_level++ == 0) - 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; + return Run(); } bool NzLuaInstance::ExecuteFromFile(const NzString& filePath) @@ -278,7 +263,7 @@ bool NzLuaInstance::ExecuteFromStream(NzInputStream& stream) StreamData data; 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); lua_pop(m_state, 1); @@ -511,9 +496,9 @@ void NzLuaInstance::PushBoolean(bool 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)