Table of Contents

APIs

Standard Libraries

First and foremost you should get familiar with the Lua reference manual, if you are new to Lua. You will find most basic Lua functionality explained there, as well as a bunch of standard library functions.

OpenComputers makes an effort to largely emulate the standard library in areas that would usually interact with the host system - that being the I/O library. There are a few differences, which you can look up here: differences in the standard libraries. Most notably, the debug library is mostly unavailable, and load only accepts text source files, no binary / pre-compiled Lua programs (for security reasons).

These standard libraries are available in the global environment and thus are immediately available; meaning they do not need to be loaded in your scripts to be accessible.

snippet.lua
print("hello world")

Custom Libraries

Following is a description of the non-standard libraries, provided for convenience.

Note that you need to require all non-standard APIs before you use them, i.e. all modules not listed in the Lua reference manual nor in [#standard_libraries]. For example, instead of simple going local rs = component.redstone, you now need to require the component API, like so:

snippet.lua
local component = require("component")
local rs = component.redstone
 
--You can of course change the variable name:
local mycomp = require("component")
local rs = mycomp.redstone

The same applies for all other APIs listed below (even sides and colors).

The standard libraries aside, OpenComputers comes with a couple of additional, built-in libraries. Here is a list of all these libraries. Note that some of these may not be usable depending on your configuration (HTTP) and context (Robot library on computers), but they'll still be there.

Contents