LuaInventory::get_item_counts(item) to get all counts of a quality

User avatar
Quezler
Filter Inserter
Filter Inserter
Posts: 269
Joined: Fri Mar 25, 2016 6:37 pm
Contact:

LuaInventory::get_item_counts(item) to get all counts of a quality

Post by Quezler »

A limitation of the inventory api is not being able to query for one item name and get back how many of each quality there are, you'd have to call it once for each quality or just go through get_contents().

it would be nice if we could get like a get_item_countS function or expand get_contents() support to add a filter for the name or something.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 4193
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: LuaInventory::get_item_counts(item) to get all counts of a quality

Post by boskid »

For 2.0.67 i added 2 methods to LuaInventory:
  • LuaInventory::get_item_count_filtered(ItemFilter) -> uint32
  • LuaInventory::get_item_quality_counts(ItemID?) -> dictionary(string, uint32)
Post Reply

Return to “Implemented mod requests”