summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/scriptapi.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/scriptapi.cpp b/src/scriptapi.cpp
index 359c14482..951ff6f83 100644
--- a/src/scriptapi.cpp
+++ b/src/scriptapi.cpp
@@ -420,7 +420,8 @@ static void inventory_set_list_from_lua(Inventory *inv, const char *name,
// removes value, keeps key for next iteration
lua_pop(L, 1);
}
- InventoryList *invlist = inv->addList(name, items.size());
+ int listsize = (forcesize != -1) ? forcesize : items.size();
+ InventoryList *invlist = inv->addList(name, listsize);
int index = 0;
for(std::list<std::string>::const_iterator
i = items.begin(); i != items.end(); i++){