copying belt contents
Posted: Fri Dec 13, 2024 3:04 am
So I have two belt entities, that are identical, except one has items on it and the other one has not. I want to copy the contents of one belt to the other.
I tried this:
The source belt holds a handful of entities:
and the destination belt reports true for dest.can_insert_at_back() before the first entity. The first entity copies over ok but now "can_insert_at_back" is false. So it only ever copies one (the first) entity.
For both, source and destination, the line length is shown as "1" in the debugger, which is weird as the source line clearly has five entities. What am I doing wrong?
I tried this:
Code: Select all
for line_index = 1, entity.get_max_transport_line_index() do
local source = entity.get_transport_line(line_index)
local dest = target.get_transport_line(line_index)
for item_index = 1, #source do
dest.insert_at_back(source[item_index])
end
source.clear()
end
and the destination belt reports true for dest.can_insert_at_back() before the first entity. The first entity copies over ok but now "can_insert_at_back" is false. So it only ever copies one (the first) entity.
For both, source and destination, the line length is shown as "1" in the debugger, which is weird as the source line clearly has five entities. What am I doing wrong?