aboutsummaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorRealBadAngel <mk@realbadangel.pl>2013-12-21 23:03:51 +0100
committerRealBadAngel <mk@realbadangel.pl>2013-12-21 23:03:51 +0100
commit7ae0b90ff7d724e02b71da21b98e5895dc1b1767 (patch)
tree1dc52500ad4b2845bf7b9fbb52bd6e69636d7d11 /src/script
parenta50db0e824eba8e0e265099df256cafc333113d7 (diff)
downloadminetest-7ae0b90ff7d724e02b71da21b98e5895dc1b1767.tar.gz
minetest-7ae0b90ff7d724e02b71da21b98e5895dc1b1767.tar.bz2
minetest-7ae0b90ff7d724e02b71da21b98e5895dc1b1767.zip
Bugfix to get_all_craft_recipes.
Indexes for empty slots shall not be skipped.
Diffstat (limited to 'src/script')
-rw-r--r--src/script/lua_api/l_craft.cpp4
1 files 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<ItemStack>::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);