mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Inventory: Make addList() consistent (#11382)
Fixes list clearing for inv:set_list() using same size, since 2db6b07
.
addList() now clears the list in all cases. Use setSize() to resize without clearing.
This commit is contained in:
parent
72927b73ca
commit
f2fd443262
3 changed files with 9 additions and 12 deletions
|
@ -1359,9 +1359,9 @@ void read_inventory_list(lua_State *L, int tableindex,
|
|||
|
||||
// Get Lua-specified items to insert into the list
|
||||
std::vector<ItemStack> items = read_items(L, tableindex,srv);
|
||||
size_t listsize = (forcesize > 0) ? forcesize : items.size();
|
||||
size_t listsize = (forcesize >= 0) ? forcesize : items.size();
|
||||
|
||||
// Create or clear list
|
||||
// Create or resize/clear list
|
||||
InventoryList *invlist = inv->addList(name, listsize);
|
||||
if (!invlist) {
|
||||
luaL_error(L, "inventory list: cannot create list named '%s'", name);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue