Module EmitterUnit

This unit is capable of emitting messages on channels.

Element class: EmitterUnit

Extends: Element

Functions

setSignalIn (plug, state) Set the value of a signal in the specified IN plug of the element.
getSignalIn (plug) Return the value of a signal in the specified IN plug of the element.
send (channel, message) Send a message on the given channel.
getRange () Returns the emitter range.
mockRegisterReceiver (callback) Mock only, not in-game: Register a receiver of calls to send().
mockGetClosure () Mock only, not in-game: Bundles the object into a closure so functions can be called with "." instead of ":".


Functions

setSignalIn (plug, state)
Set the value of a signal in the specified IN plug of the element.

Valid plug names are:

  • "in" for the in signal (seems to have no actual effect when modified this way).

Parameters:

  • plug string A valid plug name to set.
  • state 0/1 The plug signal state
getSignalIn (plug)
Return the value of a signal in the specified IN plug of the element.

Valid plug names are:

  • "in" for the in signal.

Parameters:

  • plug string A valid plug name to query.

Returns:

    0/1 The plug signal state
send (channel, message)
Send a message on the given channel. Note that only the last message is guaranteed to be propagated on the network, due to bandwidth limitations.

Note: Max channel string length is 64 characters, if the channel exceeds that the message will not be sent.

Note: Max message string length is 512 characters, any additional text will be truncated with a warning message displayed to the user.

Parameters:

  • channel string The channel name.
  • message string The message to transmit.
getRange ()
Returns the emitter range.

Returns:

    meter The range.
mockRegisterReceiver (callback)
Mock only, not in-game: Register a receiver of calls to send().

Parameters:

  • callback function The function to call (with channel and message arguments) when the send is called.

Returns:

    int The index of the callback.

See also:

mockGetClosure ()
Mock only, not in-game: Bundles the object into a closure so functions can be called with "." instead of ":".

Returns:

    table A table encompasing the api calls of object.

See also:

generated by LDoc 1.4.6 Last updated 2022-12-01 00:35:59