CC: Tweaked is a fork of ComputerCraft, adding programmable computers, turtles and more to Minecraft.
This website contains documentation for all Lua libraries and APIs from the latest version of CC: Tweaked. This documentation is still in development, so will most likely be incomplete. If you've found something you think is wrong, or would like to help out please get in touch on GitHub.
Globals
_G | Functions in the global environment, defined in bios.lua . |
---|---|
colors | The Colors API allows you to manipulate sets of colors. |
colours | Colours for lovers of British spelling. |
commands | The commands API allows your system to directly execute Minecraft commands and gather data from the results. |
disk | The Disk API allows you to interact with disk drives. |
fs | The FS API allows you to manipulate files and the filesystem. |
gps | The GPS API provides a method for turtles and computers to retrieve their own locations. |
help | Provides an API to read help files. |
http | The http library allows communicating with web servers, sending and receiving data from them. |
io | Emulates Lua's standard io library. |
keys | The Keys API provides a table of numerical codes corresponding to keyboard keys, suitable for decoding key events. |
multishell | Multishell allows multiple programs to be run at the same time. |
os | The os API allows interacting with the current computer. |
paintutils | An API for advanced systems which can draw pixels and lines, load and draw image files. |
parallel | Provides a simple implementation of multitasking. |
peripheral | The Peripheral API is for interacting with peripherals connected to the computer, such as the Disk Drive, the Advanced Monitor and Monitor. |
Control the current pocket computer, adding or removing upgrades. | |
rednet | The Rednet API allows systems to communicate between each other without using redstone. |
redstone | Interact with redstone attached to this computer. |
settings | The settings API allows to store values and save them to a file for persistent configurations for CraftOS and your programs. |
shell | The shell API provides access to CraftOS's command line interface. |
term | The Terminal API provides functions for writing text to the terminal and monitors, and drawing ASCII graphics. |
textutils | The textutils API provides helpful utilities for formatting and manipulating strings. |
turtle | The turtle API allows you to control your turtle. |
vector | The vector API provides methods to create and manipulate vectors. |
window | The Window API allows easy definition of spaces within the display that can be written/drawn to, then later redrawn/repositioned/etc as need be. |
Modules
cc.completion | A collection of helper methods for working with input completion, such as that require by _G.read. |
---|---|
cc.expect | The cc.expect library provides helper functions for verifying that function arguments are well-formed and of the correct type. |
cc.image.nft | Provides utilities for working with "nft" images. |
cc.pretty | Provides a "pretty printer", for rendering data structures in an aesthetically pleasing manner. |
cc.require | This provides a pure Lua implementation of the builtin require function and package library. |
cc.shell.completion | A collection of helper methods for working with shell completion. |
cc.strings | Various utilities for working with strings and text. |
Peripherals
command | This peripheral allows you to interact with command blocks. |
---|---|
computer | A computer or turtle wrapped as a peripheral. |
drive | Disk drives are a peripheral which allow you to read and write to floppy disks and other "mountable media" (such as computers or turtles). |
modem | The modem peripheral allows you to send messages between computers. |
monitor | Monitors are a block which act as a terminal, displaying information on one side. |
printer | The printer peripheral allows pages and books to be printed. |
speaker | Speakers allow playing notes and other sounds. |
Generic Peripherals
energy_storage | Methods for interacting with blocks using Forge's energy storage system. |
---|---|
fluid_storage | Methods for interacting with tanks and other fluid storage blocks. |
inventory | Methods for interacting with inventories. |
Events
alarm | The timer event is fired when an alarm started with os.setAlarm completes. |
---|---|
char | The char event is fired when a character is typed |
computer_command | The computer_command event is fired when the /computercraft queue command is run for the current computer. |
disk | The disk event is fired when a disk is inserted into an adjacent or networked disk drive. |
disk_eject | The disk_eject event is fired when a disk is removed from an adjacent or networked disk drive. |
http_check | The http_check event is fired when a URL check finishes. |
http_failure | The http_failure event is fired when an HTTP request fails. |
http_success | The http_success event is fired when an HTTP request returns successfully. |
key | This event is fired when any key is pressed while the terminal is focused. |
key_up | Fired whenever a key is released (or the terminal is closed while a key was being pressed). |
modem_message | The modem_message event is fired when a message is received on an open channel on any modem. |
monitor_resize | The monitor_resize event is fired when an adjacent or networked monitor's size is changed. |
monitor_touch | The monitor_touch event is fired when an adjacent or networked Advanced Monitor is right-clicked. |
mouse_click | This event is fired when the terminal is clicked with a mouse. |
mouse_drag | This event is fired every time the mouse is moved while a mouse button is being held. |
mouse_scroll | This event is fired when a mouse wheel is scrolled in the terminal. |
mouse_up | This event is fired when a mouse button is released or a held mouse leaves the computer's terminal. |
paste | The paste event is fired when text is pasted into the computer through Ctrl-V (or ⌘V on Mac). |
peripheral | The peripheral event is fired when a peripheral is attached on a side or to a modem. |
peripheral_detach | The peripheral_detach event is fired when a peripheral is detached from a side or from a modem. |
rednet_message | The rednet_message event is fired when a message is sent over Rednet. |
redstone | The redstone event is fired whenever any redstone inputs on the computer change. |
task_complete | The task_complete event is fired when an asynchronous task completes. |
term_resize | The term_resize event is fired when the main terminal is resized, mainly when a new tab is opened or closed in multishell. |
terminate | The terminate event is fired when Ctrl-T is held down. |
timer | The timer event is fired when a timer started with os.startTimer completes. |
turtle_inventory | The turtle_inventory event is fired when a turtle's inventory is changed. |
websocket_closed | The websocket_closed event is fired when an open WebSocket connection is closed. |
websocket_failure | The websocket_failure event is fired when a WebSocket connection request fails. |
websocket_message | The websocket_message event is fired when a message is received on an open WebSocket connection. |
websocket_success | The websocket_success event is fired when a WebSocket connection request returns successfully. |