Skip to content
Vexatos edited this page Jul 13, 2014 · 15 revisions

For those that don't like images: the wiki has moved to a new place, http://ocdoc.cil.li/.
This wiki will no longer be updated.


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

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

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

Custom Libraries

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.

  • Buffer: a Lua FILE* API buffer implementation for wrapping streams.
  • Colors: a global table that allows referencing standard Minecraft colors by name.
  • Component: look-up and management of components attached to the computer.
  • Computer: information on and interactions with the computer the Lua state is running on.
  • Event: a very rudimentary event system (intended for libraries) and filtered signal pulling.
  • FileSystem: abstracted interaction with file system components.
  • Internet: a wrapper for Internet Card functionality.
  • Keyboard: a table of key codes by name and pressed key tracking.
  • Note: converts music notes between their real name, their MIDI code and their frequency
  • Process: keeps track of running programs and their environments
  • Robot: abstracted access to robot actions.
  • Serialization: allows serialization of values, e.g. for sending them via the network.
  • Shell: working path tracking and program execution.
  • Sides: a global table that allows referencing sides by name.
  • Term: provides a simple readline implementation and text output.
  • Text: provides text utilities such as serialization and tab to space conversion.
  • Unicode: provides Unicode aware implementations of some functions in the string library.
Clone this wiki locally