manual: restructure, moved commandline and lua to appendix

improved lua documentation
Dieser Commit ist enthalten in:
Reinder Feenstra 2022-05-22 00:27:26 +02:00
Ursprung 940a2b64c0
Commit 1cf89063c9
50 geänderte Dateien mit 749 neuen und 279 gelöschten Zeilen

Datei anzeigen

@ -121,11 +121,18 @@
.content h2,
.content h3,
.content h4
.content h4,
.content h5,
.content h6
{
margin: 1.5em 0 0.5em 0;
}
.content p
{
margin-top: 0.5em;
}
.content table
{
border-collapse: collapse;
@ -169,6 +176,39 @@
font-size: 80%;
}
/** Badge ********************************************************************/
span.badge
{
border-radius: .6rem;
display: inline-block;
font-size: small;
font-weight: 700;
line-height: 1;
margin-left: 1rem;
padding: .25em .4em;
text-align: center;
vertical-align: baseline;
white-space: nowrap;
}
span.badge:first-child,
span.badge ~ span.badge
{
margin-left: 0;
}
span.badge.badge-lua
{
background-color: #030380;
color: #fff;
}
span.badge.badge-since
{
background-color: #28a745;
color: #fff;
}
/** Lua **********************************************************************/
code.lua span.const

Datei anzeigen

@ -25,9 +25,9 @@ Click *Yes* to allow running the installer.
### Step 4: Select language
![](../../gfx/en-us/installation/traintastic-setup-4.png)
Select language for the installation wizard and click *Ok*.
Select language for the installation wizard and click *OK*.
### Step 5: Licence agreement
### Step 5: License agreement
![](../../gfx/en-us/installation/traintastic-setup-5.png)
Select *I accept the agreement* and click *Next*.
@ -41,7 +41,7 @@ Select *Client and Server* if this computer will control the layout or select *C
![](../../gfx/en-us/installation/traintastic-setup-7.png)
Uncheck *Create a desktop shortcut* if you don't want desktop shortcuts to start Traintastic.
Firewall rules will be added to allow other pc's and device to connect to Traintastic, can be unchecked if not nessacary.
Firewall rules will be added to allow other PC's and device to connect to Traintastic, can be unchecked if not necessary.
Then click *Next*.
### Step 8: Ready for installation

Datei anzeigen

@ -10,8 +10,8 @@ When Traintastic server is running the Traintastic client can be started.
When the Traintastic client is started a *connect to server* dialog will appear.
The Traintastic client will automatically search the local network for running Traintastic servers.
Usally there is only one Traintastic server running, connect to it by clicking on the *Connect* button.
When successful the dialog will disapear and the main application dialog becomes active.
Usually there is only one Traintastic server running, connect to it by clicking on the *Connect* button.
When successful the dialog will disappear and the main application dialog becomes active.
## Main menu
@ -67,9 +67,9 @@ Disable all sound functions, this requires that sound or mute decoder functions
### ![](../../gfx/toolbar/no_smoke.png) No smoke
Disable all smoke generators, this requires that all smoke generater decoder functions are set to the *Smoke* type, see [decoder function function](../object/decoderfunction.md#decoder-function-function).
Disable all smoke generators, this requires that all smoke generator decoder functions are set to the *Smoke* type, see [decoder function function](../object/decoderfunction.md#decoder-function-function).
### Edit mode
Traintastic as a special *edit mode*, when the world is not in edit mode most settings that define the layout can't be changed.
This prevents making accidential changes during layout operation. Changing some settings also also requires the world to be stopped.
This prevents making accidental changes during layout operation. Changing some settings also also requires the world to be stopped.

Datei anzeigen

@ -3,7 +3,7 @@
When running Traintastic, the server should be started first.
**Windows:** The Traintastic server can be started using the desktop icon (if installed) or by selecting *Traintastic* -> *Traintastic server* from the Windows start menu.
Traintastic server runs as backgroud process, a Traintastic icon will appear in the system tray next to the clock.
Traintastic server runs as background process, a Traintastic icon will appear in the system tray next to the clock.
A Windows notification is displayed when it is running in the background.
Traintastic server can be quit by clicking on the Traintastic icon and selecting *Quit* from the popup menu.

Datei anzeigen

@ -0,0 +1,3 @@
# Hardware {#hardware}
TODO

Datei anzeigen

@ -0,0 +1,3 @@
# Interfaces {#hardware-interfaces}
TODO

Datei anzeigen

@ -0,0 +1,3 @@
# LocoNet interface {#hardware-interface-loconet}
TODO

Datei anzeigen

@ -7,9 +7,9 @@ This appendix describes Traintastic's LocoNet implementation details.
## Supported LocoNet command stations {#loconet-command-stations}
The following LocoNet command stations are verified to work with Traintastic:
- Digikeijs DR5000
- Uhlenblock Intellibox 65000
- Uhlenbrock IB-COM 65071
- [Digikeijs DR5000](supportedhardware/digikeijs/dr5000.md)
- [Uhlenblock Intellibox 65000](supportedhardware/uhlenbrock/intellibox.md)
- [Uhlenbrock IB-COM 65071](supportedhardware/uhlenbrock/ibcom.md)
LocoNet command stations not listed here will probably work but aren't tested.
@ -17,7 +17,7 @@ LocoNet command stations not listed here will probably work but aren't tested.
The following LocoNet interfaces are verified to work with Traintastic:
- RoSoft LocoNet interface
- Uhlenbrock LocoNet interface 63120
- [Uhlenbrock LocoNet interface 63120](supportedhardware/uhlenbrock/loconetinterface63120.md)
LocoNet interfaces not listed here might work but aren't tested.

Datei anzeigen

@ -1,3 +1,11 @@
# Lua scripting {#lua}
# Lua scripting reference {#lua}
TODO
[![Lua logo](../gfx/lua/Lua-Logo_128x128.png)](https://lua.org)
Lua is a scripting language developed at PUC-Rio in Brazil.
Lua is a lightweight and easy to learn scripting language especially designed to be embedded in other applications like Traintastic.
Lua (pronounced as LOO-ah) means *Moon* in Portuguese.
**Badges**:
- The $badge:since:v0.1$ badge indicates in which version of Traintastic it is added.
- The $badge:lua$ badge indicates it is a standard Lua function.

Datei anzeigen

@ -1,13 +0,0 @@
# Decoder protocol {#lua-enum-decoder-protocol}
Global prefix: `enum.decoder_protocol`
## Values
| Value | Description |
| ----------- | ----------- |
| `AUTO` | |
| `DCC` | |
| `MOTOROLA` | |
| `SELECTRIX` | |
| `CUSTOM` | |

Datei anzeigen

@ -1,10 +0,0 @@
# Direction {#lua-enum-direction}
Global prefix: `enum.direction`
## Values
| Value | Description |
| --------- | ----------- |
| `FORWARD` | |
| `REVERSE` | |

Datei anzeigen

@ -1,12 +0,0 @@
# Direction control state {#lua-enum-direction-control-state}
Global prefix: `enum.direction_control_state`
## Values
| Value | Description |
| -------- | ----------- |
| `NONE` | |
| `A_TO_B` | |
| `B_TO_A` | |
| `BOTH` | |

Datei anzeigen

@ -1,12 +0,0 @@
# Signal aspect {#lua-enum-signal-aspect}
Global prefix: `enum.signal_aspect`
## Values
| Value | Description |
| ----------------------- | ----------- |
| `UNKNOWN` | |
| `STOP` | |
| `PROCEED` | |
| `PROCEED_REDUCED_SPEED` | |

Datei anzeigen

@ -1,14 +0,0 @@
# Turnout position {#lua-enum-turnout-position}
Global prefix: `enum.turnout_position`
## Values
| Value | Description |
| ---------- | ----------- |
| `UNKNOWN` | |
| `STRAIGHT` | |
| `LEFT` | |
| `RIGHT` | |
| `CROSSED` | |
| `DIVERGED` | |

Datei anzeigen

@ -1,20 +0,0 @@
# World event {#lua-enum-world-event}
Global prefix: `enum.world_event`
## Values
| Value | Description |
| --------------- | ----------- |
| `EDIT_DISABLED` | |
| `EDIT_ENABLED` | |
| `OFFLINE` | |
| `ONLINE` | |
| `POWER_OFF` | |
| `POWER_ON` | |
| `STOP` | |
| `RUN` | |
| `UNMUTE` | |
| `MUTE` | |
| `NO_SMOKE` | |
| `SMOKE` | |

Datei anzeigen

@ -1,13 +0,0 @@
# World scale {#lua-enum-world-scale}
Global prefix: `enum.world_scale`
## Values
| Value | Description | Ratio |
| -------- | ------------ | ----- |
| `H0` | H0 scale | 1:87 |
| `TT` | TT scale | 1:120 |
| `N` | N scale | 1:160 |
| `Z` | Z scale | 1:220 |
| `CUSTOM` | Custom scale | |

Datei anzeigen

@ -1,9 +0,0 @@
# Enums {#lua-enums}
- [`decoder_protocol`](enum/decoderprotocol.md)
- [`direction`](enum/direction.md)
- [`direction_control_state`](enum/directioncontrolstate.md)
- [`signal_aspect`](enum/signalaspect.md)
- [`turnout_position`](enum/turnoutposition.md)
- [`world_event`](enum/worldevent.md)
- [`world_scale`](enum/worldscale.md)

Datei anzeigen

@ -5,55 +5,74 @@ TODO
## Constants
`CODENAME` - Traintastic release name or development branch, e.g. `"master"`.
### `CODENAME` $badge:since:v0.1$
Traintastic release name or development branch, e.g. `"master"`.
`LUA_VERSION` - Lua version and copyright, e.g. `"Lua 5.3.3 Copyright (C) 1994-2016 Lua.org, PUC-Rio"`
### `LUA_VERSION` $badge:since:v0.1$
Lua version and copyright, e.g. `"Lua 5.3.3 Copyright (C) 1994-2016 Lua.org, PUC-Rio"`
`VERSION` - Traintastic version, e.g. `"0.1.0"`
### `VERSION` $badge:since:v0.1$
Traintastic version, e.g. `"0.1.0"`
`VERSION_MAJOR` - Traintastic major version, e.g. `0`
### `VERSION_MAJOR` $badge:since:v0.1$
Traintastic major version, e.g. `0`
`VERSION_MINOR` - Traintastic minor version, e.g. `1`
### `VERSION_MINOR` $badge:since:v0.1$
Traintastic minor version, e.g. `1`
`VERSION_PATCH` - Traintastic patch level, e.g. `0`
### `VERSION_PATCH` $badge:since:v0.1$
Traintastic patch level, e.g. `0`
## Variables
### `world` $badge:since:v0.1$
The global [world object](object/world.md).
## Functions
`assert()`
### `assert()` $badge:since:v0.1$ $badge:lua$
TODO
`get_class()`
### `ipairs()` $badge:since:v0.1$ $badge:lua$
TODO
`ipairs()`
### `next()` $badge:since:v0.1$ $badge:lua$
TODO
`next()`
### `pairs()` $badge:since:v0.1$ $badge:lua$
TODO
`pairs()`
### `tonumber()` $badge:since:v0.1$ $badge:lua$
TODO
`tonumber()`
### `tostring()` $badge:since:v0.1$ $badge:lua$
TODO
`tostring()`
`type()`
### `type()` $badge:since:v0.1$
TODO
## Objects
## Libraries
`log`
### `class` $badge:since:v0.1$
The [class library](library/class.md).
`world`
### `enum` $badge:since:v0.1$
The [enum library](library/enum.md).
### `log` $badge:since:v0.1$
The [log library](library/log.md).
## ???
### `math` $badge:since:v0.1$
The [math library](library/math.md).
`class`
### `set` $badge:since:v0.1$
The [set library](library/set.md).
`enum`
### `string` $badge:since:v0.1$
The [string library](library/string.md).
`math`
`set`
`string`
`table`
### `table` $badge:since:v0.1$
The [table library](library/table.md).

Datei anzeigen

@ -0,0 +1,19 @@
# Class library {#lua-class}
TODO
## Constants
### `class.WORLD` $badge:since:v0.1$
TODO
## Functions
### `class.get(object)` $badge:since:v0.1$
Returns the class type of *object*, or `nil` if *object* isn't a valid object.
#### Example
```lua
class.get(world) -- returns: class.WORLD
```

Datei anzeigen

@ -0,0 +1,3 @@
# Enum library {#lua-enum}
TODO

Datei anzeigen

@ -0,0 +1,20 @@
# `enum.decoder_protocol` $badge:since:v0.1$ {#lua-enum-decoderprotocol}
TODO
## Constants
### `enum.decoder_protocol.AUTO` $badge:since:v0.1$
TODO
### `enum.decoder_protocol.DCC` $badge:since:v0.1$
NMRA DCC.
### `enum.decoder_protocol.MOTOROLA` $badge:since:v0.1$
TODO
### `enum.decoder_protocol.SELECTRIX` $badge:since:v0.1$
TODO
### `enum.decoder_protocol.CUSTOM` $badge:since:v0.1$
TODO

Datei anzeigen

@ -0,0 +1,11 @@
# `enum.direction` $badge:since:v0.1$ {#lua-enum-direction}
TODO
## Constants
### `enum.direction.FORWARD` $badge:since:v0.1$
TODO
### `enum.direction.REVERSE` $badge:since:v0.1$
TODO

Datei anzeigen

@ -0,0 +1,17 @@
# `enum.direction_control_state` $badge:since:v0.1$ {#lua-enum-directioncontrolstate}
TODO
## Constants
### `enum.direction_control_state.NONE` $badge:since:v0.1$
TODO
### `enum.direction_control_state.A_TO_B` $badge:since:v0.1$
TODO
### `enum.direction_control_state.B_TO_A` $badge:since:v0.1$
TODO
### `enum.direction_control_state.BOTH` $badge:since:v0.1$
TODO

Datei anzeigen

@ -0,0 +1,17 @@
# `enum.signal_aspect` $badge:since:v0.1$ {#lua-enum-signalaspect}
TODO
## Constants
### `enum.signal_aspect.UNKNOWN` $badge:since:v0.1$
TODO
### `enum.signal_aspect.STOP` $badge:since:v0.1$
TODO
### `enum.signal_aspect.PROCEED` $badge:since:v0.1$
TODO
### `enum.signal_aspect.PROCEED_REDUCED_SPEED` $badge:since:v0.1$
TODO

Datei anzeigen

@ -0,0 +1,14 @@
# `enum.tri_state` $badge:since:v0.1$ {#lua-enum-tristate}
TODO
## Constants
### `enum.tri_state.UNDEFINED` $badge:since:v0.1$
TODO
### `enum.tri_state.FALSE` $badge:since:v0.1$
TODO
### `enum.tri_state.TRUE` $badge:since:v0.1$
TODO

Datei anzeigen

@ -0,0 +1,23 @@
# `enum.turnout_position` $badge:since:v0.1$ {#lua-enum-turnoutposition}
TODO
## Constants
### `enum.turnout_position.UNKNOWN` $badge:since:v0.1$
TODO
### `enum.turnout_position.STRAIGHT` $badge:since:v0.1$
TODO
### `enum.turnout_position.LEFT` $badge:since:v0.1$
TODO
### `enum.turnout_position.RIGHT` $badge:since:v0.1$
TODO
### `enum.turnout_position.CROSSED` $badge:since:v0.1$
TODO
### `enum.turnout_position.DIVERGED` $badge:since:v0.1$
TODO

Datei anzeigen

@ -0,0 +1,47 @@
# `enum.world_event` $badge:since:v0.1$ {#lua-enum-worldevent}
TODO
## Constants
### `enum.world_event.EDIT_DISABLED` $badge:since:v0.1$
TODO
### `enum.world_event.EDIT_ENABLED` $badge:since:v0.1$
TODO
### `enum.world_event.OFFLINE` $badge:since:v0.1$
TODO
### `enum.world_event.ONLINE` $badge:since:v0.1$
TODO
### `enum.world_event.POWER_OFF` $badge:since:v0.1$
TODO
### `enum.world_event.POWER_ON` $badge:since:v0.1$
TODO
### `enum.world_event.STOP` $badge:since:v0.1$
TODO
### `enum.world_event.RUN` $badge:since:v0.1$
TODO
### `enum.world_event.UNMUTE` $badge:since:v0.1$
TODO
### `enum.world_event.MUTE` $badge:since:v0.1$
TODO
### `enum.world_event.NO_SMOKE` $badge:since:v0.1$
TODO
### `enum.world_event.SMOKE` $badge:since:v0.1$
TODO
### `enum.world_event.SIMULATION_DISABLED` $badge:since:v0.1$
TODO
### `enum.world_event.SIMULATION_ENABLED` $badge:since:v0.1$
TODO

Datei anzeigen

@ -0,0 +1,20 @@
# `enum.world_scale` $badge:since:v0.1$ {#lua-enum-worldscale}
TODO
## Constants
### `enum.world_scale.H0` $badge:since:v0.1$
H0 scale. (1:87)
### `enum.world_scale.N` $badge:since:v0.1$
N scale. (1:160)
### `enum.world_scale.TT` $badge:since:v0.1$
TT scale. (1:120)
### `enum.world_scale.Z` $badge:since:v0.1$
Z scale. (1:220)
### `enum.world_scale.CUSTOM` $badge:since:v0.1$
TODO

Datei anzeigen

@ -0,0 +1,19 @@
# Log library {#lua-log}
TODO
## Functions
### `debug(...)` $badge:since:v0.1$
### `info(...)` $badge:since:v0.1$
### `notice(...)` $badge:since:v0.1$
### `warning(...)` $badge:since:v0.1$
### `error(...)` $badge:since:v0.1$
### `critical(...)` $badge:since:v0.1$
### `fatal(...)` $badge:since:v0.1$

Datei anzeigen

@ -0,0 +1,86 @@
# Math library {#lua-math}
TODO
## Functions
### `math.abs()` $badge:since:v0.1$ $badge:lua$
TODO
### `math.acos()` $badge:since:v0.1$ $badge:lua$
TODO
### `math.asin()` $badge:since:v0.1$ $badge:lua$
TODO
### `math.atan()` $badge:since:v0.1$ $badge:lua$
TODO
### `math.ceil()` $badge:since:v0.1$ $badge:lua$
TODO
### `math.cos()` $badge:since:v0.1$ $badge:lua$
TODO
### `math.deg()` $badge:since:v0.1$ $badge:lua$
TODO
### `math.exp()` $badge:since:v0.1$ $badge:lua$
TODO
### `math.floor()` $badge:since:v0.1$ $badge:lua$
TODO
### `math.fmod()` $badge:since:v0.1$ $badge:lua$
TODO
### `math.huge()` $badge:since:v0.1$ $badge:lua$
TODO
### `math.log()` $badge:since:v0.1$ $badge:lua$
TODO
### `math.max()` $badge:since:v0.1$ $badge:lua$
TODO
### `math.maxinteger()` $badge:since:v0.1$ $badge:lua$
TODO
### `math.min()` $badge:since:v0.1$ $badge:lua$
TODO
### `math.mininteger()` $badge:since:v0.1$ $badge:lua$
TODO
### `math.modf()` $badge:since:v0.1$ $badge:lua$
TODO
### `math.pi()` $badge:since:v0.1$ $badge:lua$
TODO
### `math.rad()` $badge:since:v0.1$ $badge:lua$
TODO
### `math.random()` $badge:since:v0.1$ $badge:lua$
TODO
### `math.randomseed()` $badge:since:v0.1$ $badge:lua$
TODO
### `math.sin()` $badge:since:v0.1$ $badge:lua$
TODO
### `math.sqrt()` $badge:since:v0.1$ $badge:lua$
TODO
### `math.tan()` $badge:since:v0.1$ $badge:lua$
TODO
### `math.tointeger()` $badge:since:v0.1$ $badge:lua$
TODO
### `math.type()` $badge:since:v0.1$ $badge:lua$
TODO
### `math.ult()` $badge:since:v0.1$ $badge:lua$
TODO

Datei anzeigen

@ -0,0 +1,3 @@
# Set library {#lua-set}
TODO

Datei anzeigen

@ -0,0 +1,26 @@
# `set.world_state` $badge:since:v0.1$ {#lua-set-worldstate}
TODO
## Constants
### `set.world_state.EDIT` $badge:since:v0.1$
TODO
### `set.world_state.ONLINE` $badge:since:v0.1$
TODO
### `set.world_state.POWER_ON` $badge:since:v0.1$
TODO
### `set.world_state.RUN` $badge:since:v0.1$
TODO
### `set.world_state.MUTE` $badge:since:v0.1$
TODO
### `set.world_state.NO_SMOKE` $badge:since:v0.1$
TODO
### `set.world_state.SIMULATION` $badge:since:v0.1$
TODO

Datei anzeigen

@ -0,0 +1,51 @@
# String library {#lua-string}
TODO
## `string.byte()` $badge:since:v0.1$ $badge:lua$
TODO
## `string.char()` $badge:since:v0.1$ $badge:lua$
TODO
## `string.find()` $badge:since:v0.1$ $badge:lua$
TODO
## `string.format()` $badge:since:v0.1$ $badge:lua$
TODO
## `string.gmatch()` $badge:since:v0.1$ $badge:lua$
TODO
## `string.gsub()` $badge:since:v0.1$ $badge:lua$
TODO
## `string.len()` $badge:since:v0.1$ $badge:lua$
TODO
## `string.lower()` $badge:since:v0.1$ $badge:lua$
TODO
## `string.match()` $badge:since:v0.1$ $badge:lua$
TODO
## `string.pack()` $badge:since:v0.1$ $badge:lua$
TODO
## `string.packsize()` $badge:since:v0.1$ $badge:lua$
TODO
## `string.rep()` $badge:since:v0.1$ $badge:lua$
TODO
## `string.reverse()` $badge:since:v0.1$ $badge:lua$
TODO
## `string.sub()` $badge:since:v0.1$ $badge:lua$
TODO
## `string.unpack()` $badge:since:v0.1$ $badge:lua$
TODO
## `string.upper()` $badge:since:v0.1$ $badge:lua$
TODO

Datei anzeigen

@ -0,0 +1,24 @@
# Table library {#lua-table}
TODO
## `table.concat()` $badge:since:v0.1$ $badge:lua$
TODO
## `table.insert()` $badge:since:v0.1$ $badge:lua$
TODO
## `table.pack()` $badge:since:v0.1$ $badge:lua$
TODO
## `table.unpack()` $badge:since:v0.1$ $badge:lua$
TODO
## `table.remove()` $badge:since:v0.1$ $badge:lua$
TODO
## `table.move()` $badge:since:v0.1$ $badge:lua$
TODO
## `table.sort()` $badge:since:v0.1$ $badge:lua$
TODO

Datei anzeigen

@ -2,14 +2,18 @@
## Properties
`string id`
### `id`
Object id, unique within the world.
### `name`
Input name.
`string name`
## Methods
*None.*
## Events
*None.*

Datei anzeigen

@ -0,0 +1,38 @@
# Input {#lua-object-input}
## Properties
### `id`
Object id, unique within the world.
### `name`
Input name.
### `value`
Input value, an `enum.tristate` value.
Note: The input value can be `enum.tristate.UNDEFINED`, especially when just connected to the hardware.
## Methods
### `get_object(id)`
Get object with *id*, if it exists it returns the object, 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_value_changed`
Fired when the input value changes.
Handler: `function (value, input, user_data)`
- *value* - `true` if the input value changed to high, `false` if the input value changed to low;
- *input* - the input object;
- *user_data* - user data that was set or `nil` if no user data was set during connect.

Datei anzeigen

@ -1,25 +0,0 @@
# Log {#lua-object-log}
## Properties
*None.*
## Methods
`debug(...)`
`info(...)`
`notice(...)`
`warning(...)`
`error(...)`
`critical(...)`
`fatal(...)`
## Events
*None.*

Datei anzeigen

@ -0,0 +1,3 @@
# List {#lua-object-objectlist}
TODO

Datei anzeigen

@ -1,31 +1,53 @@
# World {#lua-object-world}
## Properties
`object_list boards`
### `boards` $badge:since:v0.1$
[List](objectlist.md) of all boards.
`string name`
### `name` $badge:since:v0.1$
World name.
`object_list rail_vehicles`
### `rail_vehicles` $badge:since:v0.1$
[List](objectlist.md) of all rail vehicles.
`world_scale scale`
### `scale` $badge:since:v0.1$
World scale, an [`enum.world_scale`](../library/enum/worldscale.md) value.
`number scale_ratio`
### `scale_ratio` $badge:since:v0.1$
World scale ratio in 1:*value*, e.g. for H0 it returns 87.
`world_state state`
### `state` $badge:since:v0.1$
World state, a [`set.world_state`](../library/set/worldstate.md) value.
`object_list trains`
### `trains` $badge:since:v0.1$
[List](objectlist.md) of all trains.
### `uuid` $badge:since:v0.1$
World UUID (Universal Unique Identifier), every world that is created has its own unique UUID.
`string uuid`
## Methods
`object get_object(string id)`
### `get_object(id)` $badge:since:v0.1$
Get object with *id*, if it exists it returns the object, else it returns `nil`.
`power_off()`
### `power_off()` $badge:since:v0.1$
Stop all vehicles and power off, identical to pressing power off in the Traintastic client application.
### `stop()` $badge:since:v0.1$
Stop all vehicles, identical to pressing stop in the Traintastic client application.
`stop()`
## Events
`on_event(world_state state, world_event event)`
### `on_event` $badge:since:v0.1$
Fired when the world state changes,
e.g. when pressing the stop button in the Traintastic client application or calling `world.stop()`.
Handler: `function (state, event, world, user_data)`
- *state* - a [`set.world_state`](../library/set/worldstate.md) value;
- *event* - an [`enum.world_event`](../library/enum/worldevent.md) value;
- *world* - the world object;
- *user_data* - user data that was set or `nil` if no user data was set during connect.

Datei anzeigen

@ -1,5 +1,4 @@
# Objects {#lua-objects}
- [Board](object/board.md)
- [Log](object/log.md)
- [World](object/world.md)

Datei anzeigen

@ -1,14 +0,0 @@
# World state {#lua-set-world-state}
Global prefix: `set.world_state`
## Values
| Value | Description |
| ---------- | ----------- |
| `EDIT` | |
| `ONLINE` | |
| `POWER_ON` | |
| `RUN` | |
| `MUTE` | |
| `NO_SMOKE` | |

Datei anzeigen

@ -1,3 +0,0 @@
# Sets {#lua-sets}
- [`world_state`](set/worldstate.md)

Datei anzeigen

@ -0,0 +1,3 @@
# Lua scripting examples {#lua-examples}
TODO

Datei anzeigen

@ -0,0 +1,7 @@
# Scripting {#scripting}
*"Where [actions](actions.md) end scripting begins."*
TODO
See the [Lua scripting reference](lua.md) and the [Lua scripting examples](luaexamples.md) for more details about Traintastic's scripting possibilities.

Datei anzeigen

@ -4,4 +4,4 @@ Traintastic supports hardware of various vendors.
This appendix list hardware that is (partly) supported along with instructions and notes how to use it with Traintastic.
Product's that aren't listed may still work if they are compatible with a product listed here.
The list is alphabatically ordered by vendor name.
The list is alphabetically ordered by vendor name.

Datei anzeigen

@ -0,0 +1,3 @@
# Uhlenbrock IB-COM {#uhlenbrock-ibcom}
TODO

Datei anzeigen

@ -0,0 +1,3 @@
# Uhlenbrock LocoNet interface 63120 {#uhlenbrock-loconet-interface-63120}
TODO

Binäre Datei nicht angezeigt.

Nachher

Breite:  |  Höhe:  |  Größe: 9.1 KiB

Datei anzeigen

@ -28,6 +28,20 @@
}
]
},
{
"type": "chapter",
"markdown": "hardware.md",
"pages": [
{
"markdown": "hardware/interface.md",
"pages": [
{
"markdown": "hardware/interface/loconet.md"
}
]
}
]
},
{
"type": "chapter",
"markdown": "trainsandvehicles.md",
@ -60,80 +74,7 @@
},
{
"type": "chapter",
"markdown": "lua.md",
"code": "lua",
"pages": [
{
"markdown": "lua/globals.md",
"code": "lua"
},
{
"markdown": "lua/enums.md",
"code": "lua",
"pages": [
{
"markdown": "lua/enum/decoderprotocol.md",
"code": "lua"
},
{
"markdown": "lua/enum/direction.md",
"code": "lua"
},
{
"markdown": "lua/enum/directioncontrolstate.md",
"code": "lua"
},
{
"markdown": "lua/enum/turnoutposition.md",
"code": "lua"
},
{
"markdown": "lua/enum/signalaspect.md",
"code": "lua"
},
{
"markdown": "lua/enum/worldevent.md",
"code": "lua"
},
{
"markdown": "lua/enum/worldscale.md",
"code": "lua"
}
]
},
{
"markdown": "lua/sets.md",
"code": "lua",
"pages": [
{
"markdown": "lua/set/worldstate.md",
"code": "lua"
}
]
},
{
"markdown": "lua/objects.md",
"code": "lua",
"pages": [
{
"markdown": "lua/object/board.md",
"code": "lua"
},
{
"markdown": "lua/object/log.md",
"code": "lua"
},
{
"markdown": "lua/object/world.md",
"code": "lua"
}
]
}
]
},
{
"type": "chapter",
"markdown": "commandlineoptions.md"
"markdown": "scripting.md"
},
{
"type": "appendix",
@ -163,8 +104,14 @@
{
"markdown": "supportedhardware/traintastic/usbxpressnetinterface.md"
},
{
"markdown": "supportedhardware/uhlenbrock/ibcom.md"
},
{
"markdown": "supportedhardware/uhlenbrock/intellibox.md"
},
{
"markdown": "supportedhardware/uhlenbrock/loconetinterface63120.md"
}
]
},
@ -202,5 +149,111 @@
"markdown": "messages/debug.md"
}
]
},
{
"type": "appendix",
"markdown": "lua.md",
"code": "lua",
"pages": [
{
"markdown": "lua/globals.md",
"code": "lua"
},
{
"markdown": "lua/library/class.md",
"code": "lua"
},
{
"markdown": "lua/library/enum.md",
"code": "lua",
"pages": [
{
"markdown": "lua/library/enum/decoderprotocol.md",
"code": "lua"
},
{
"markdown": "lua/library/enum/direction.md",
"code": "lua"
},
{
"markdown": "lua/library/enum/directioncontrolstate.md",
"code": "lua"
},
{
"markdown": "lua/library/enum/signalaspect.md",
"code": "lua"
},
{
"markdown": "lua/library/enum/turnoutposition.md",
"code": "lua"
},
{
"markdown": "lua/library/enum/worldevent.md",
"code": "lua"
},
{
"markdown": "lua/library/enum/worldscale.md",
"code": "lua"
}
]
},
{
"markdown": "lua/library/log.md",
"code": "lua"
},
{
"markdown": "lua/library/math.md",
"code": "lua"
},
{
"markdown": "lua/library/set.md",
"code": "lua",
"pages": [
{
"markdown": "lua/library/set/worldstate.md",
"code": "lua"
}
]
},
{
"markdown": "lua/library/string.md",
"code": "lua"
},
{
"markdown": "lua/library/table.md",
"code": "lua"
},
{
"markdown": "lua/objects.md",
"code": "lua",
"pages": [
{
"markdown": "lua/object/board.md",
"code": "lua"
},
{
"markdown": "lua/object/input.md",
"code": "lua"
},
{
"markdown": "lua/object/objectlist.md",
"code": "lua"
},
{
"markdown": "lua/object/world.md",
"code": "lua"
}
]
}
]
},
{
"type": "appendix",
"markdown": "luaexamples.md",
"code": "lua"
},
{
"type": "appendix",
"markdown": "commandlineoptions.md"
}
]

Datei anzeigen

@ -10,7 +10,7 @@ class HTMLBuilder(Builder):
def _file_to_html(self, page):
with codecs.open(os.path.join(self._language_dir, page['markdown']), 'r', 'utf-8') as md:
html = cmarkgfm.github_flavored_markdown_to_html(md.read())
html = cmarkgfm.github_flavored_markdown_to_html(md.read(), options=cmarkgfm.Options.CMARK_OPT_UNSAFE)
# parse id
html = re.sub(r'<h([1-6])([^>]*)>(.*) {#([a-z0-9-]+)}</h\1>', r'<h\1\2 id="\4">\3</h\1>', html)
@ -32,6 +32,10 @@ class HTMLBuilder(Builder):
'<figcaption>' + m.group(2) + '</figcaption></figure>',
html)
# handle badges
html = html.replace('$badge:lua$', '<span class="badge badge-lua">Lua</span>')
html = re.sub(r'\$badge:since:v([0-9]+\.[0-9]+(|\.[0-9]+))\$', r'<span class="badge badge-since">&ge; \1\2</span>', html)
return html
def _highlight_lua(self, m):