pub struct ExternalEditorApi { /* private fields */ }
Expand description

A struct representing Tabletop Simulators External Editor API.

Implementations§

Get a list containing the states for every object. Returns an AnswerReload message on success. If no connection to the game can be established, an io::Error gets returned instead.

Update the Lua scripts and UI XML for any objects listed in the message, and then reloads the save file, the same way it does when pressing “Save & Play” within the in-game editor. Returns an AnswerReload message. If no connection to the game can be established, an io::Error gets returned instead.

Any objects mentioned have both their Lua script and their UI XML updated. If no value is set for either the “script” or “ui” key then the corresponding Lua script or UI XML is deleted.

Send a custom message to be forwarded to the onExternalMessage event handler in the currently loaded game. The value of customMessage must be an object, and is passed as a parameter to the event handler. If no connection to the game can be established, an io::Error gets returned.

If this value is not an object then the event is not triggered.

Executes a lua script globally and returns the value in a AnswerReturn message. If no connection to the game can be established, an io::Error gets returned instead.

Executes a lua script on an object and returns the value in a AnswerReturn message. If no connection to the game can be established, an io::Error gets returned instead.

To execute Lua code for an object in the game that object must have an associated script in TTS. Otherwise the TTS scripting engine will fail with an error “function <executeScript>: Object reference not set to an instance of an object”. Once the in-game editor shows a script associated with an object then TTS will be able to execute Lua code sent via JSON message for that object.

Creates a new ExternalEditorApi struct and binds the TcpListener to its socket adress.

Sends a Message in a TcpStream. If no connection to the game can be established, an io::Error gets returned.

Accepts the next incoming Answer from the listener. This function will block the calling thread until a new TCP connection is established and an answer gets recieved.

Reads incoming Answer messages until an answer matches the generic. This function will block the calling thread until a new TCP connection is established and an answer gets recieved.

Trait Implementations§

Formats the value using the given formatter. Read more

Creates a new ExternalEditorApi struct and binds the TcpListener to its socket adress. This is functionally the same as using ExternalEditorApi::new().

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.