World
$object.world:description$
Properties
boards
Board list object.
clock
Clock object.
name
World name
rail_vehicles
Rail vehicle list object.
scale
scale_ratio
World scale, e.g. 87 means 1:87 (H0 scale)
state
World state, a combination of World state values.
trains
Train list object.
uuid
World UUID, unique for each world.
zones
$object.world.zones:description$
Methods
get_object(id)
Get object with id.
Parameters:
id
Object id
Return values
Object if it exists with the given id, else it returns nil.
power_off()
Stop all vehicles and power off, identical to pressing power off in the Traintastic client application.
stop()
Stop all vehicles, identical to pressing stop in the Traintastic client application.
Events
on_event
Fired when the world state changes, e.g. when pressing the power on, power off, stop, run etc. button in the Traintastic client application or calling world.stop().
Handler signature
function (state, event, user_data)
Arguments
-
state- World state, a combination of World state values. -
event- The World event. -
user_data- optional user-provided value (see Events).