Module ReceiverUnit
Receives messages on given channels.
Element class: ReceiverUnit
Extends: Element
Functions
getRange () | Returns the receiver range. |
hasChannel (channel) | Checks if the given channel exists in the receiver channels list. |
setChannels (channelList) | Deprecated: Set the channels list. |
setChannelList (channels) | Set the channels list. |
getChannels () | Deprecated: Returns the channels list. |
getChannelList () | Returns the channels list. |
getSignalOut (plug) | Return the value of a signal in the specified OUT plug of the element. |
EVENT_receive (channel, message) | Deprecated: Event: Emitted when a message is received on any channel defined on the element. |
EVENT_onReceived (channel, message) | Event: Emitted when a message is received on any channel defined on the element. |
mockRegisterReceive (callback, channel, message) | Mock only, not in-game: Register a handler for the in-game `receive(channel,message)` event. |
mockDoReceive (channel, message) | Mock only, not in-game: Simulates a message reaching the receiver. |
mockGetClosure () | Mock only, not in-game: Bundles the object into a closure so functions can be called with "." instead of ":". |
Functions
- getRange ()
-
Returns the receiver range.
Returns:
-
float
The range in m (meters).
- hasChannel (channel)
-
Checks if the given channel exists in the receiver channels list.
Parameters:
- channel string The channel to check for.
Returns:
-
0/1
1 if the channels list contains the given channel.
- setChannels (channelList)
-
Deprecated: Set the channels list.
This method is deprecated: setChannelList should be used instead
Parameters:
- channelList string The channels list separated by commas.
See also:
- setChannelList (channels)
-
Set the channels list.
Parameters:
- channels list The channels list as a Lua table. At most 8 channels may be set, but a comma-separated string in the table will be split on the commas into multiple channels.
Returns:
-
0/1
1 if the channels list has been successfully set.
- getChannels ()
-
Deprecated: Returns the channels list.
This method is deprecated: getChannelList should be used instead
Returns:
-
string
The channels list separated by commas.
See also:
- getChannelList ()
-
Returns the channels list.
Returns:
-
list
The channels list as a Lua table.
- getSignalOut (plug)
-
Return the value of a signal in the specified OUT plug of the element.
Valid plug names are:
- "out" for the out signal.
Parameters:
- plug string A valid plug name to query.
Returns:
-
0/1
The plug signal state
- EVENT_receive (channel, message)
-
Deprecated: Event: Emitted when a message is received on any channel defined on the element.
Note: This is documentation on an event handler, not a callable method.
This event is deprecated: EVENT_onReceived should be used instead.
Parameters:
See also:
- EVENT_onReceived (channel, message)
-
Event: Emitted when a message is received on any channel defined on the element.
Note: This is documentation on an event handler, not a callable method.
Parameters:
- mockRegisterReceive (callback, channel, message)
-
Mock only, not in-game: Register a handler for the in-game `receive(channel,message)` event.
Parameters:
- callback function The function to call when the a message is received.
- channel string The channel to filter on, or "*" for all.
- message string The message to filter for, or "*" for all.
Returns:
-
int
The index of the callback.
See also:
- mockDoReceive (channel, message)
-
Mock only, not in-game: Simulates a message reaching the receiver.
Parameters:
- 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: