Home

LuaTransportLine

One line on a transport belt.

Attributes

owner

The entity this transport line belongs to.

output_lines

The transport lines that this transport line outputs items to or an empty table if none.

input_lines

The transport lines that this transport line is fed by or an empty table if none.

line_length

Length of the transport line. Items can be inserted at line position from 0 up to returned value

total_segment_length

Total length of segment which consists of this line, all lines in front and lines in the back directly connected.

valid

Is this object valid? This Lua object holds a reference to an object within the game engine. It is possible that the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the object becomes invalid, i.e. this attribute will be false. Mods are advised to check for object validity if any change to the game state might have occurred between the creation of the Lua object and its access.

object_name

The class name of this object. Available even when valid is false. For LuaStruct objects it may also be suffixed with a dotted path to a member of the struct.

Methods

clear

LuaTransportLine.clear()

Call As

transportLine.clear()

Call Convention

Remove all items from this transport line.

get_item_count

LuaTransportLine.get_item_count(item?: ItemFilter) -> uint32

Call As

transportLine.get_item_count()

Call Convention

Count some or all items on this line, similar to how LuaInventory::get_item_count does.

Parameters

Returns

remove_item

LuaTransportLine.remove_item(items: ItemStackIdentification) -> uint32

Call As

transportLine.remove_item(items)

Call Convention

Remove some items from this line.

Parameters

Returns

can_insert_at

LuaTransportLine.can_insert_at(position: float) -> boolean

Call As

transportLine.can_insert_at(position)

Call Convention

Can an item be inserted at a given position?

Parameters

Returns

can_insert_at_back

LuaTransportLine.can_insert_at_back() -> boolean

Call As

transportLine.can_insert_at_back()

Call Convention

Can an item be inserted at the back of this line?

Returns

insert_at

LuaTransportLine.insert_at(position: float, items: ItemStackIdentification, belt_stack_size?: uint8) -> boolean

Call As

transportLine.insert_at(position, items, belt_stack_size)

Call Convention

Insert items at a given position.

Parameters

Returns

insert_at_back

LuaTransportLine.insert_at_back(items: ItemStackIdentification, belt_stack_size?: uint8) -> boolean

Call As

transportLine.insert_at_back(items, belt_stack_size)

Call Convention

Insert items at the back of this line.

Parameters

Returns

force_insert_at

LuaTransportLine.force_insert_at(position: float, items: ItemStackIdentification, belt_stack_size?: uint8)

Call As

transportLine.force_insert_at(position, items, belt_stack_size)

Call Convention

Force insert item at a given position. Inserts item onto a transport line. If a position is out of range, it is clamped to a closest valid position on the transport line. Item will be inserted regardless of other items nearby, possibly forcing items to become squashed.

Parameters

get_contents

LuaTransportLine.get_contents() -> ItemWithQualityCounts

Call As

transportLine.get_contents()

Call Convention

Get counts of all items on this line, similar to how LuaInventory::get_contents does.

Returns

get_detailed_contents

LuaTransportLine.get_detailed_contents() -> Array<DetailedItemOnLine>

Call As

transportLine.get_detailed_contents()

Call Convention

Get detailed information of items on this line, such as their position.

Returns

line_equals

LuaTransportLine.line_equals(other: LuaTransportLine) -> boolean

Call As

transportLine.line_equals(other)

Call Convention

Returns whether the associated internal transport line of this line is the same as the others associated internal transport line.

This can return true even when the LuaTransportLine::owners are different (so this == other is false), because the internal transport lines can span multiple tiles.

Parameters

Returns

get_line_item_position

LuaTransportLine.get_line_item_position(position: float) -> MapPosition

Call As

transportLine.get_line_item_position(position)

Call Convention

Get a map position related to a position on a transport line.

Parameters

Returns