component - interface with components
The component API is provided by OpenComputers. This manual page attempts to document it.
Note that this manual page covers both OS-provided methods and OpenComputers-provided methods.
list([filter:string[, exact:boolean]]): table
Returns an iterable list of components - keys addresses, values types. If filter is specified, only includes matches of component type. If exact is specified, only includes exact matches.
invoke(address:string, method:string[, ...]): ...
Attempts to invoke the specified method on the component with address address.
Creates a proxy of the component with address address. All callable fields are in the proxy, along with the address, type, and slot.
doc(address:string, method:string): string
Returns the documentation string for the component callback method. Note that the documenation string for most methods is also available by tostringing the function in a proxy, i.e. tostring(component.screen.isOn).
Returns the component type of the component with address address.
Returns the slot in which the component of address address is installed, or -1 if it does not otherwise make sense.
Returns a table with the names of all non-callable fields that will be present in the proxy of a component, i.e. address and type, as keys. Complements component.methods.
Returns a table with the names of all callable methods that will be present in the proxy of a component as keys.
The following component API methods are provided by Monolith and OpenOS.
get(address:string[, type:string]): string or nil, string
Tries to resolve the abbreviated address address to a full component UUID.
Returns whether at least one component of type type is installed in the computer.
Both OSes also provide a metatable that allows for the syntax component.<componentType> to obtain a proxy of a component of that type.
The OpenOS implementation provides a system for "primary" components, which Monolith deos not currently but may in the future.