From: RealBadAngel Date: Sat, 21 Dec 2013 22:03:51 +0000 (+0100) Subject: Bugfix to get_all_craft_recipes. X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=7ae0b90ff7d724e02b71da21b98e5895dc1b1767;p=zefram%2Fminetest%2Fminetest_engine.git Bugfix to get_all_craft_recipes. Indexes for empty slots shall not be skipped. --- diff --git a/src/script/lua_api/l_craft.cpp b/src/script/lua_api/l_craft.cpp index ef13aa82..aaca84c5 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);