From bf37688b1151101f049211151b3a1ebfef6c5a5e Mon Sep 17 00:00:00 2001 From: Lynix Date: Sun, 24 Jun 2018 21:49:51 +0200 Subject: [PATCH] Lua/LuaState: Fix std::vector query for good --- include/Nazara/Lua/LuaState.inl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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");