IO documentation
Introductions
Currently only allows computers to interface with peripherals, however functionality will be extended to networking as well
The io api exists in the global space as "io" or "_G.io"
Lookup table
| getPeripherals() | Gets a list of all attached peripheral IDs |
| getType(id) | Gets a text description of a peripheral |
| getTag(id) | Gets the peripherals tag |
| isCompatibility(id) | Checks if the peripheral is from CC:T |
| setTag(id, tag = nil) | Sets the peripherals tag |
| queryTag(tag) | Gets the ids of all peripherals with the tag |
| queryType(type) | Gets the ids of all peripherals of the type |
| wrapPeripheral(id) | Creates an interface to interact with a peripheral |
| callFunction(id, function, arguments...) | calls a specific function from a peripheral |
| broadcastLocal(arguments...) | Broadcasts the arguments to all other computers on the network |
Functions in detail
getPeripherals()
Return a list of all attached peripherals' id
Parameters: None Returns: [string]getType(id)
Gets a text description of a peripheral based on its id
Parameters: ID[String] Returns: StringgetTag(id)
Gets a peripherals tag based on its id
Parameters: ID[String] Returns: StringisCompatibility(id)
Tests if the peripheral is adapted from CC:Tweaked
Parameters: ID[String] Returns: BooleansetTag(id)
Sets the tag of the peripheral with the id
Parameters: ID[String] Returns: StringqueryTag(id)
Gets the ids of all peripherals with the tag
Parameters: ID[String] Returns: StringqueryType(id)
Gets the ids of all peripherals of the type
Parameters: ID[String] Returns: StringwrapPeripheral(id)
Wraps the peripheral into ann API like table that contains its functions in a lua accessible object
Parameters: ID[String] Returns: TablecallFunction(id, function, arguments...)
Attempts to call a specific function from a peripheral, passing the arguments following the function parameter
Parameters: ID[String], Function[String], Arguments[Any]... Returns: AnybroadcastLocal(arguments...)
Broadcasts the arguments to all other computers on the connected wired network, triggering the networkMessage event on all receiving computers
Parameters: Arguments[Any primitive]... Returns: NoneEvent table
peripheralAttached [System]
| peripheralAttached[String] | Type[String] | UUID[String] |
| Triggered when a peripheral is attached to the computer | ||
peripheralDetached [System]
| peripheralDetached[String] | Type[String] | UUID[String] |
| Triggered when a peripheral is disconnected to the computer | ||
networkMessage [Network]
| networkMessage[Network] | Arguments... [Any primitive] |
| Fired when a message is received from a network cable, the amount of arguments is variable | |