From 7ae0b90ff7d724e02b71da21b98e5895dc1b1767 Mon Sep 17 00:00:00 2001 From: RealBadAngel Date: Sat, 21 Dec 2013 23:03:51 +0100 Subject: [PATCH] Bugfix to get_all_craft_recipes. Indexes for empty slots shall not be skipped. --- src/script/lua_api/l_craft.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/script/lua_api/l_craft.cpp b/src/script/lua_api/l_craft.cpp index ef13aa82c..aaca84c56 100644 --- a/src/script/lua_api/l_craft.cpp +++ b/src/script/lua_api/l_craft.cpp @@ -410,11 +410,11 @@ int ModApiCraft::l_get_all_craft_recipes(lua_State *L) lua_newtable(L); lua_newtable(L); // items std::vector::const_iterator iter = input.items.begin(); - for (u16 j = 0; iter != input.items.end(); iter++) { + for (u16 j = 1; iter != input.items.end(); iter++, j++) { if (iter->empty()) continue; lua_pushstring(L, iter->name.c_str()); - lua_rawseti(L, -2, ++j); + lua_rawseti(L, -2, j); } lua_setfield(L, -2, "items"); setintfield(L, -1, "width", input.width);