Skip to content
Igor Timofeev edited this page Jan 23, 2019 · 7 revisions

This library is provided as default global variable by OpenComputers and allows to interact with computer components. In addition to it, MineOS adds some useful methods.

<<<<<<< HEAD

Contents
component.isAvailable
component.get
=======

OpenComputers methods

component.proxy(string address): table or nil proxy

Returns proxy of component with given address is this component is available or nil otherwise.

component.proxy("3da4522c-ddf0-42ee-8a3d-2ec3a80b0769")
> table

component.list(string or nil name): function iterator -> address, name

Returns an iterator function over available components matching given name or just all components:

for address, name in component.list("gpu") do
  -- Do something
end

component.doc(string address, string method): string or nil documentation

Returns the documentation string for the method with given name of the component with given address if any, or nil otherwise.

component.invoke(string address, string method, ...): ...

Calls the method with given name on the component with given address, passing the remaining arguments as arguments to that method. Returns the result of the method call.

MineOS methods

parent of 236d947... Updated Component API (markdown)

component.isAvailable(string name): boolean available

Checks if any component with given name is available in computer environment:

component.isAvailable("gpu")
> true

component.get(string name): table or nil proxy

Returns proxy of first available component with given name on success, nil otherwise.

component.get("gpu")
> table

Clone this wiki locally