Page 1 of 1

Any chance "export_stack" API will handle any LuaItemStack?

Posted: Wed Aug 26, 2026 8:59 pm
by freeafrica
I would love to use `LuaItemStack:export_stack` call in my mod, to move around items from a massive amount of belts keeping stacks unchanged with same position, however it only covers items that have the ingame "export" functionality.

Currently I am using `get_detailed_contents` on the belt, to keep stacks unchanged, I use `transfer_stack` call. However, that makes all previous stacks (returned by the `get_detailed_contents` method) invalid... so I need to recall it for each stacks left on the belt. This scales up quite badly w/ many belts and items on them...

If there would be some serialize call on `LuaItemStack` I could just save that together with stack-belt-positions, hitting the game-API only once for the `get_detailed_contents`, then empty the whole belt and reimport.

Inserting happens one-by-one too (using the game-API), so I guess it would still not change the order-of-magnitude, just the `get_detailed_contents` feels like a more expensive method, not sure though.

Re: Any chance "export_stack" API will handle any LuaItemStack?

Posted: Wed Aug 26, 2026 11:01 pm
by Rseding91
What are you actually trying to do? “Get detailed contents” can be used backwards to move entire lines. Or if you just want a copy then clone the belt. If you want a new belt at the same position then fast replace it.