Module advtrains_doc_integration.utils
Utility functions.
Functions
map (tbl, func) | Create a table by applying a function to each element. |
spairs (tbl[, sort]) | Create an iterator that iterates through the table in the order of the keys sorted in a certain order. |
get_coupler_name (str) | Gets the name of the coupler |
adjust_soundspec (spec) | Adjust the soundspec to table form. |
texture_escape (str) | Escape the texture string. |
Functions
- map (tbl, func)
-
Create a table by applying a function to each element.
Parameters:
- tbl table The table to map from.
- func function The function to apply.
Returns:
-
table
The resulting table.
- spairs (tbl[, sort])
-
Create an iterator that iterates through the table in the order of
the keys sorted in a certain order.
Note that the behavior is undefined if a key is added during the iteration.
Parameters:
- tbl table The table to iterate
- sort function The function passed to table.sort for sorting the keys. The default sorting order is used if the function is not provided. (optional)
Returns:
-
An iterator suitable for use with Lua's
for
loop. - get_coupler_name (str)
-
Gets the name of the coupler
Parameters:
- str string The technical name of the coupler
Returns:
-
string
The name of the coupler
- adjust_soundspec (spec)
-
Adjust the soundspec to table form.
Parameters:
- spec SimpleSoundSpec The soundspec to adjust.
Returns:
-
SimpleSoundSpec
The adjusted soundspec.
- texture_escape (str)
-
Escape the texture string.
Parameters:
- str string The texture string to escape.
Returns:
-
string
The escaped texture string.