diff --git a/include/Nazara/Lua/LuaState.inl b/include/Nazara/Lua/LuaState.inl index 136220bf7..97a0827b0 100644 --- a/include/Nazara/Lua/LuaState.inl +++ b/include/Nazara/Lua/LuaState.inl @@ -172,11 +172,11 @@ namespace Nz Nz::CallOnExit popStack { [&instance]() { instance.Pop(); } }; instance.PushInteger(pos++); - if (instance.GetTable(index) == Nz::LuaType_Nil) + int tableIndex = (index < 0) ? index - 1 : index; + if (instance.GetTable(tableIndex) == Nz::LuaType_Nil) break; - T arg {}; - + T arg; if (LuaImplQueryArg(instance, -1, &arg, TypeTag()) != 1) { instance.Error("Type needs more than one place to be initialized");