How do I only count items with a certain quality?

Place to get help with not working mods / modding interface.
Yemto
Burner Inserter
Burner Inserter
Posts: 16
Joined: Sun Aug 28, 2016 1:52 pm
Contact:

How do I only count items with a certain quality?

Post by Yemto »

Pretty much what the title says. I noticed that when I use get_item_count It does not factor in quality, so when I want to try and count all uncommon pipe, I get all pipes in the inventory, not just the uncommon one.
User avatar
LCStark
Fast Inserter
Fast Inserter
Posts: 171
Joined: Thu Jan 28, 2021 5:04 pm
Contact:

Re: How do I only count items with a certain quality?

Post by LCStark »

What are you using the `get_item_count()` on? `LuaInventory` defines `get_item_count()` with a parameter `item::ItemWithQualityID?`, so you can easily filter by quality:
11-04-2024, 13-07-37.png
11-04-2024, 13-07-37.png (155.8 KiB) Viewed 159 times
Yemto
Burner Inserter
Burner Inserter
Posts: 16
Joined: Sun Aug 28, 2016 1:52 pm
Contact:

Re: How do I only count items with a certain quality?

Post by Yemto »

I did it directly on LuaPlayer. When I changed it so I get the inventory before calling get_item_count then it works like it should. Thank you so much
Post Reply

Return to “Modding help”