Count of items in crafting machine

Place to get help with not working mods / modding interface.
User avatar
moon69
Fast Inserter
Fast Inserter
Posts: 184
Joined: Sun Sep 18, 2016 6:53 pm
Contact:

Count of items in crafting machine

Post by moon69 »

In a mod, how can I see how many input and output items a crafting machine is holding?

The info is available in the tool-tip, but I can't figure out how to access it programmatically.
Image

Thanks.
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3749
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Count of items in crafting machine

Post by DaveMcW »

Code: Select all

local input_count = entity.get_inventory(defines.inventory.assembling_machine_input)[1].count
local output_count = entity.get_inventory(defines.inventory.assembling_machine_output)[1].count
User avatar
moon69
Fast Inserter
Fast Inserter
Posts: 184
Joined: Sun Sep 18, 2016 6:53 pm
Contact:

Re: Count of items in crafting machine

Post by moon69 »

Thanks!
Post Reply

Return to “Modding help”