projects
/
zefram
/
minetest
/
minetest_engine.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a50db0e
)
Bugfix to get_all_craft_recipes.
author
RealBadAngel
<mk@realbadangel.pl>
Sat, 21 Dec 2013 22:03:51 +0000
(23:03 +0100)
committer
RealBadAngel
<mk@realbadangel.pl>
Sat, 21 Dec 2013 22:03:51 +0000
(23:03 +0100)
Indexes for empty slots shall not be skipped.
src/script/lua_api/l_craft.cpp
patch
|
blob
|
history
diff --git
a/src/script/lua_api/l_craft.cpp
b/src/script/lua_api/l_craft.cpp
index ef13aa82ce69f1d2aab81b8dab3e4c09f3d39cb7..aaca84c5601291977ed9194ac0db5c6b6109c832 100644
(file)
--- 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);