Page 1 of 1

spoil_priority parameter for LuaInventory:remove()

Posted: Tue Jul 14, 2026 3:19 am
by LeonSkills
I'd like to remove spoilable items from inventories prioritised by their spoilage level, similar to the functionality of inserters.

I could write a function to loop over all the item stacks, filter for the item I'm looking for, and sort them by spoil time.
But I wonder since the functionality already exists for inserters, that it might be possible to expose this in the LuaInventory:remove method.

So a
LuaInventory:remove(items, spoil_priority), with spoil_priority of type SpoilPriority, defaulting to "none".

Additionally (or instead), a LuaInventory:find_item_stack(item, spoil_priority), could work as well.