diff --git a/library/LuaTools.cpp b/library/LuaTools.cpp index ed0b0699d..a1bf855d6 100644 --- a/library/LuaTools.cpp +++ b/library/LuaTools.cpp @@ -121,10 +121,10 @@ void DFHack::Lua::Push(lua_State *state, const df::coord2d &pos) lua_setfield(state, -2, "y"); } -void DFHack::Lua::GetVector(lua_State *state, std::vector &pvec) +void DFHack::Lua::GetVector(lua_State *state, std::vector &pvec, int idx) { lua_pushnil(state); // first key - while (lua_next(state, 1) != 0) + while (lua_next(state, idx) != 0) { pvec.push_back(lua_tostring(state, -1)); lua_pop(state, 1); // remove value, leave key diff --git a/library/include/LuaTools.h b/library/include/LuaTools.h index 86d3d0c7e..689d82260 100644 --- a/library/include/LuaTools.h +++ b/library/include/LuaTools.h @@ -359,7 +359,7 @@ namespace DFHack {namespace Lua { } } - DFHACK_EXPORT void GetVector(lua_State *state, std::vector &pvec); + DFHACK_EXPORT void GetVector(lua_State *state, std::vector &pvec, int idx = 1); DFHACK_EXPORT int PushPosXYZ(lua_State *state, const df::coord &pos); DFHACK_EXPORT int PushPosXY(lua_State *state, const df::coord2d &pos);