Home

LuaSchedule

The schedule of a particular LuaTrain or LuaSpacePlatform.

Attributes

owner

The owner of this schedule.

interrupt_count

current

The schedule index of the current destination.

tick_of_last_schedule_change

tick_of_last_activity

The time when the train or space platform was last considered active for the inactivity condition.

Note: when writing, value must not be larger than LuaGameScript::tick

ticks_in_station

How long this train or space platform has been in the current station.

group

The group this schedule is part of, if any.

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

add_wait_condition

LuaSchedule.add_wait_condition(record_position: ScheduleRecordPosition, condition_index: uint32, type: WaitConditionType)

Call As

schedule.add_wait_condition(record_position, condition_index, type)

Call Convention

Adds the given wait condition to the given record.

Parameters

remove_wait_condition

LuaSchedule.remove_wait_condition(record_position: ScheduleRecordPosition, condition_index: uint32)

Call As

schedule.remove_wait_condition(record_position, condition_index)

Call Convention

Removes the given wait condition from the given record.

Parameters

set_wait_condition_mode

LuaSchedule.set_wait_condition_mode(record_position: ScheduleRecordPosition, condition_index: uint32, mode: string)

Call As

schedule.set_wait_condition_mode(record_position, condition_index, mode)

Call Convention

Sets the comparison on the given wait condition.

Parameters

change_wait_condition

LuaSchedule.change_wait_condition(record_position: ScheduleRecordPosition, condition_index: uint32, wait_condition: WaitCondition)

Call As

schedule.change_wait_condition(record_position, condition_index, wait_condition)

Call Convention

Changes the wait condition on the given record to the new values.

Parameters

add_record

LuaSchedule.add_record(data: AddRecordData) -> uint32?

Call As

schedule.add_record(data)

Call Convention

Adds the given record to the end of the current schedule or at the given index using the provided data.

Parameters

Returns

remove_record

LuaSchedule.remove_record(record_position: ScheduleRecordPosition)

Call As

schedule.remove_record(record_position)

Call Convention

Removes the record at the given record position, if the record position is valid.

Parameters

copy_record

LuaSchedule.copy_record(source_schedule: LuaSchedule, source_index: uint32, destination_index: uint32)

Call As

schedule.copy_record(source_schedule, source_index, destination_index)

Call Convention

Copies the record from the given schedule at the given index into this schedule at the given index.

Parameters

add_interrupt

LuaSchedule.add_interrupt(interrupt: ScheduleInterrupt)

Call As

schedule.add_interrupt(interrupt)

Call Convention

Adds the given interrupt to the schedule if an interrupt with the given name does not already exist.

Parameters

remove_interrupt

LuaSchedule.remove_interrupt(index: uint32)

Call As

schedule.remove_interrupt(index)

Call Convention

Removes the interrupt at the given index, if the index is valid.

Parameters

activate_interrupt

LuaSchedule.activate_interrupt(index: uint32)

Call As

schedule.activate_interrupt(index)

Call Convention

Activates the interrupt at the given index, if the index is valid.

Parameters

change_interrupt

LuaSchedule.change_interrupt(index: uint32, interrupt: ScheduleInterrupt)

Call As

schedule.change_interrupt(index, interrupt)

Call Convention

Changes the interrupt at the given index to the provided values. Note, the names must match.

Parameters

rename_interrupt

LuaSchedule.rename_interrupt(old_name: string, new_name: string)

Call As

schedule.rename_interrupt(old_name, new_name)

Call Convention

Parameters

go_to_station

LuaSchedule.go_to_station(schedule_index: uint32)

Call As

schedule.go_to_station(schedule_index)

Call Convention

Sets the train or space platform to go to a destination, including changing the train/space platform to automatic mode.

Parameters

set_stopped

LuaSchedule.set_stopped(stopped: boolean)

Call As

schedule.set_stopped(true)

Call Convention

Sets whether this train is in manual mode or this space platform is paused.

Parameters

set_allow_unloading

LuaSchedule.set_allow_unloading(record_position: ScheduleRecordPosition, allow: boolean)

Call As

schedule.set_allow_unloading(record_position, true)

Call Convention

Sets if unloading is allowed at the given schedule record position. Only relevant for space platforms.

Parameters

drag_record

LuaSchedule.drag_record(from: uint32, to: uint32, interrupt_index?: uint32)

Call As

schedule.drag_record(from, to, interrupt_index)

Call Convention

Parameters

drag_interrupt

LuaSchedule.drag_interrupt(from: uint32, to: uint32)

Call As

schedule.drag_interrupt(from, to)

Call Convention

Parameters

drag_wait_condition

LuaSchedule.drag_wait_condition(record_position: ScheduleRecordPosition, from: uint32, to: uint32)

Call As

schedule.drag_wait_condition(record_position, from, to)

Call Convention

Parameters

get_record

LuaSchedule.get_record(record_position: ScheduleRecordPosition) -> ScheduleRecord?

Call As

schedule.get_record(record_position)

Call Convention

Parameters

Returns

get_records

LuaSchedule.get_records(interrupt_index?: uint32) -> Array<ScheduleRecord>?

Call As

schedule.get_records()

Call Convention

Parameters

Returns

set_records

LuaSchedule.set_records(records: Array<ScheduleRecord>, interrupt_index?: uint32)

Call As

schedule.set_records(records, interrupt_index)

Call Convention

Parameters

clear_records

LuaSchedule.clear_records(interrupt_index?: uint32)

Call As

schedule.clear_records()

Call Convention

Parameters

get_interrupt

LuaSchedule.get_interrupt(index: uint32) -> ScheduleInterrupt?

Call As

schedule.get_interrupt(index)

Call Convention

Parameters

Returns

get_interrupts

LuaSchedule.get_interrupts() -> Array<ScheduleInterrupt>

Call As

schedule.get_interrupts()

Call Convention

Returns

set_interrupts

LuaSchedule.set_interrupts(interrupts: Array<ScheduleInterrupt>)

Call As

schedule.set_interrupts(interrupts)

Call Convention

Parameters

clear_interrupts

LuaSchedule.clear_interrupts()

Call As

schedule.clear_interrupts()

Call Convention

Removes all interrupts.

get_wait_condition

LuaSchedule.get_wait_condition(record_position: ScheduleRecordPosition, condition_index: uint32) -> WaitCondition?

Call As

schedule.get_wait_condition(record_position, condition_index)

Call Convention

Gets the wait condition at the given record position if one exists.

Parameters

Returns

get_wait_conditions

LuaSchedule.get_wait_conditions(record_position: ScheduleRecordPosition) -> Array<WaitCondition>?

Call As

schedule.get_wait_conditions(record_position)

Call Convention

Gets the wait conditions at the given record position if they exist.

Parameters

Returns

get_wait_condition_count

LuaSchedule.get_wait_condition_count(record_position: ScheduleRecordPosition) -> uint32?

Call As

schedule.get_wait_condition_count(record_position)

Call Convention

The number of wait conditions in the given schedule record.

Parameters

Returns

get_inside_interrupt

LuaSchedule.get_inside_interrupt(interrupt_index: uint32) -> boolean

Call As

schedule.get_inside_interrupt(interrupt_index)

Call Convention

Gets if the given interrupt can be triggered inside other interrupts.

Parameters

Returns

set_inside_interrupt

LuaSchedule.set_inside_interrupt(interrupt_index: uint32, value: boolean)

Call As

schedule.set_inside_interrupt(interrupt_index, true)

Call Convention

Sets if the given interrupt can be triggered inside other interrupts.

Parameters

get_record_count

LuaSchedule.get_record_count(interrupt_index?: uint32) -> uint32?

Call As

schedule.get_record_count()

Call Convention

If the given index is invalid, nil is returned.

Parameters

Returns