World
$object.world:description$
Properties
boards
≥ 0.1- Board list object.
clock
≥ 0.2- Clock object.
name
≥ 0.1- World name
rail_vehicles
- Rail vehicle list object.
scale
≥ 0.1- World scale.
scale_ratio
≥ 0.1- World scale, e.g.
87
means1:87
(H0 scale) state
≥ 0.1- World state, a combination of World state values.
trains
- Train list object.
uuid
≥ 0.1- World UUID, unique for each world.
Methods
get_object ≥ 0.1
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 ≥ 0.1
power_off()
Stop all vehicles and power off, identical to pressing power off in the Traintastic client application.
stop ≥ 0.1
stop()
Stop all vehicles, identical to pressing stop in the Traintastic client application.
Events
on_event
≥ 0.1
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()
.
function (state, event, user_data)
state
- World state, a combination of World state values.
event
- The World event.
user_data
- User data that was set or
nil
if no user data was set during connect.