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
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

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: String

getTag(id)

Gets a peripherals tag based on its id

Parameters: ID[String] Returns: String

setTag(id)

Sets the tag of the peripheral with the id

Parameters: ID[String] Returns: String

queryTag(id)

Gets the ids of all peripherals with the tag

Parameters: ID[String] Returns: String

queryType(id)

Gets the ids of all peripherals of the type

Parameters: ID[String] Returns: String

wrapPeripheral(id)

Wraps the peripheral into ann API like table that contains its functions in a lua accessible object

Parameters: ID[String] Returns: Table

callFunction(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: Any