Type Wirelink
Wirelink
Methods
| addOutputCallback( id, callback ) | Adds an output change callback to the wirelink. |
| entity() | Returns the entity that the wirelink represents. |
| getOutputConnections( outputName ) | Returns the connections that have been made to the given wire output, or nil if no connections have been made. |
| getWiredTo( inputName ) | Returns the entity the given input is wired to. |
| getWiredToName( inputName ) | Returns the name of the output the given input is wired to. |
| inputType( name ) | Returns the type of input name, or nil if it doesn't exist. |
| inputs() | Returns a table of all of the wirelink's input names. |
| isValid() | Checks if a wirelink is valid. |
| isWired( inputName ) | Checks if an input is wired. |
| outputType( name ) | Returns the type of output name, or nil if it doesn't exist. |
| outputs() | Returns a table of all of the wirelink's output names. |
| removeOutputCallback( id ) | Removes an output change callback you registered. |
Methods
- Wirelink:addOutputCallback( id, callback )
-
Adds an output change callback to the wirelink. This is called whenever an output changes. It is passed the wirelink, output name and new output value.
Environment:
ServerParameters:
-
id: Identifier, used to remove it later if you need to. -
callback: The function to run when an output changes.
Usage:
Wirelink:addOutputCallback( "MyAwesomeCallback", function( Wirelink, Output, Value ) print( Wirelink, Output, Value ) end )
-
- Wirelink:entity()
-
Returns the entity that the wirelink represents.
Environment:
Server - Wirelink:getOutputConnections( outputName )
-
Returns the connections that have been made to the given wire output, or nil if no connections have been made.
Environment:
ServerParameters:
-
(string) outputName: The name of the output to get the connections for.
-
- Wirelink:getWiredTo( inputName )
-
Returns the entity the given input is wired to.
Environment:
ServerParameters:
-
(string) inputName: The name of the input to get the entity for.
Return value:
(Entity | nil)The entity wired to the given input, if the input exists and is wired. Otherwise nil. -
- Wirelink:getWiredToName( inputName )
-
Returns the name of the output the given input is wired to.
Environment:
ServerParameters:
-
(string) inputName: the name of the input to get the output name for.
Return value:
(string | nil)The name of the output the given input is wired to, if the input exists and is wired. Otherwise nil. -
- Wirelink:inputType( name )
-
Returns the type of input name, or nil if it doesn't exist.
Environment:
ServerParameters:
-
(string) name: The name of the input to get the type of.
-
- Wirelink:inputs()
-
Returns a table of all of the wirelink's input names.
Environment:
Server - Wirelink:isValid()
-
Checks if a wirelink is valid. (ie. doesn't point to an invalid entity)
Environment:
Server - Wirelink:isWired( inputName )
-
Checks if an input is wired.
Environment:
ServerParameters:
-
(string) inputName: The name of the input to check.
-
- Wirelink:outputType( name )
-
Returns the type of output name, or nil if it doesn't exist.
Environment:
ServerParameters:
-
(string) name: The name of the output to get the type of.
-
- Wirelink:outputs()
-
Returns a table of all of the wirelink's output names.
Environment:
Server - Wirelink:removeOutputCallback( id )
-
Removes an output change callback you registered.
Environment:
ServerParameters:
-
id: The ID you used to register it.
-