Skip to content
MethodDescription
isTrainPassing()Checks if a train is detected
getPassingTrainName()Gets the detected train's name
EventDescription
train_passingTriggers when the observer detects a train
train_passedTriggers when the observer stops detecting a train

isTrainPassing()

Checks if a train is currently within the train observer's range.

Returns

  • boolean The state of the observer. true means it's outputting redstone signal.

getPassingTrainName()

Gets the name of a train within the train observer's range.

Returns

  • string The name of the train detected, or nil if none is found.

Events

The following are events that can be accessed with os.pullEvent(filter).

Event: train_passing

Triggers whenever a train enters the observer's range.

Returns

  • string Name of train.

Event: train_passed

Triggers whenever a train leaves the observer's range.

Returns

  • string Name of train.