Train Simulator NEXT
In This Topic
    Framework information
    In This Topic

    Please notice: This reference includes currently functionality which was valid for SG scripts. SG scripts ore no longer used in Train Simulator NEXT due some API limitations.

    The full feature-set for scripting is awaited to be integrated into the developers builds from week 36. So this documenation currently is only useful to get a brief overview.

    Train Simulator NEXT is using Lua as the programming language for script files.

    About Information
    Lua version

    5.4.6 (released 14 may 2023)

    → Reference manual

    Integrated frameworks

    The supported feature set is limited:

    • Base
    • Coroutine
    • Debug
    • Math
    • String
    • Table
    • UTF8

    The framework is extended.

    Limited Framework

    To reduce security risks and to prevent hacks into the application, Train Simulator NEXT limits the functionality of lua. The table below shows and describes the removed or changed functionality.

    Framework / Function Information
    IO framework

    Developers may write files onto users computer without a standardized system.

    The save game and load game events are passed to Lua scripts. Also, Train Simulator NEXT provides a system to read the script state by an internal environment securely and in a standardized way. Read more about it in the Load and Save Event guide.

    Package framework Attackers may load third executable files and execute them with full-access to all APIs on users computer.
    print, println functions

    If the debug console is enabled in Train Simulator NEXT, these functions will print the contents into the debug console. So use them only to debug scripts directly.

    To write information into the internal debug manager of Train Simulator NEXT, use the functions debug(), show_error(), warn(), log(), reset_log() and enable_log().

    OS framework

    Attackers may execute code, force the application to exit, remove or rename files on users computer.

    To get information about time, game time, frames per second etc., use the extended framework.

    It is not common that scripts for shape files may need these functionalities.

    See Also