Hi all,
I have a wagon full of blueprints. How do I allow a script to access the blueprint data for the third blueprint in the wagon?
From what I can see LuaStackItem has accessors but I’m not sure how to use it to access individual blueprints.
Thanks
How to access blueprints in wagon?
Re: How to access blueprints in wagon?
Assuming you have the wagon already (also untested off thetop ofmy head)
Code: Select all
local inv = WagonEntity.get_inventory(defines.inventory.cargo_wagon)
if inv[3].valid_for_read then
-- inv[3] is the itemstack do stuff
end
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: How to access blueprints in wagon?
Specifically LuaInventory behaves like a numerically indexed iterable table of LuaItemStack, so you can iterate or directly access numerically.
Code: Select all
for i=1,#LuaInventory do
local this_stack = LuaInventory[i]
end
Re: How to access blueprints in wagon?
thanks, I'll give these a try.