Getting Lua/ItemStack from inventory?

Place to get help with not working mods / modding interface.
GopherAtl
Fast Inserter
Fast Inserter
Posts: 177
Joined: Sat Jan 31, 2015 7:54 pm
Contact:

Getting Lua/ItemStack from inventory?

Post by GopherAtl »

I may just be missing the obvious due to lack of sleep, but I can't find any way to get the Lua/ItemStack objects from an inventory. There are a couple of specific exceptions - the player's currently held itemstack, and the item held by an inserter, but other than that, it seems like everything gives a Lua/SimpleItemStack, or gives the equivalent information in some other format like get_contents() on a Lua/Inventory object. For some items, blueprints in particular, probably modular armor as well, the Lua/ItemStack contains a lot of information that it seems there's no way to get at when they're just in a slot in an inventory.
My Mods:
Nixie Tubes - numeric displays for your circuit networks!
Logistic Combinators - use logistics values in circuit logic! -
Autowire - automate red/green wire connections
Rseding91
Factorio Staff
Factorio Staff
Posts: 15876
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Getting Lua/ItemStack from inventory?

Post by Rseding91 »

GopherAtl wrote:I may just be missing the obvious due to lack of sleep, but I can't find any way to get the Lua/ItemStack objects from an inventory. There are a couple of specific exceptions - the player's currently held itemstack, and the item held by an inserter, but other than that, it seems like everything gives a Lua/SimpleItemStack, or gives the equivalent information in some other format like get_contents() on a Lua/Inventory object. For some items, blueprints in particular, probably modular armor as well, the Lua/ItemStack contains a lot of information that it seems there's no way to get at when they're just in a slot in an inventory.
I updated the wiki for this: https://forums.factorio.com/wiki/inde ... x_operator
If you want to get ahold of me I'm almost always on Discord.
GopherAtl
Fast Inserter
Fast Inserter
Posts: 177
Joined: Sat Jan 31, 2015 7:54 pm
Contact:

Re: Getting Lua/ItemStack from inventory?

Post by GopherAtl »

Rseding91 wrote:
GopherAtl wrote:I may just be missing the obvious due to lack of sleep, but I can't find any way to get the Lua/ItemStack objects from an inventory. There are a couple of specific exceptions - the player's currently held itemstack, and the item held by an inserter, but other than that, it seems like everything gives a Lua/SimpleItemStack, or gives the equivalent information in some other format like get_contents() on a Lua/Inventory object. For some items, blueprints in particular, probably modular armor as well, the Lua/ItemStack contains a lot of information that it seems there's no way to get at when they're just in a slot in an inventory.
I updated the wiki for this: https://forums.factorio.com/wiki/inde ... x_operator
:facepalm: yeah. I figured there had to be an obvious way I was missing XD Thankee-sai!
My Mods:
Nixie Tubes - numeric displays for your circuit networks!
Logistic Combinators - use logistics values in circuit logic! -
Autowire - automate red/green wire connections
Post Reply

Return to “Modding help”