Skip to main content

Blocks

CCraft Studio's logic is written by snapping together visual blocks (powered by Blockly) instead of typing Lua. Each screen has its own block workspace; on export, those blocks are turned into the Lua in logic/<ScreenName>.lua. This page lists the block categories — not every individual block.

How blocks become Lua

Blocks compile to Lua during export. Event blocks become handlers registered on the screen; everything you stack inside them becomes the handler body. For example, a “when this screen loads” block wrapping a set property block compiles to:

screen.events.onceLoaded = function()
screen:childSetProp("label1", "text", "Hello World!")
end

See the Runtime API for the objects (screen, getChild, childSetProp, …) these handlers use.

Block categories

The toolbox groups blocks into the categories below. Programming and CC: Tweaked API categories work in any export mode; Interface blocks only affect Full and UI Only exports.

GroupCategories
TriggersEvents
InterfacesInterfaces
ProgrammingControl · Logic · Math · Text · Lists · Variables · Functions
CC: Tweaked APIsTerminal · Turtle · Rednet · Redstone · Files · Paint Utils · Window · HTTP · Utility · System (OS) · Peripheral · Disk · Modem
Plugins (mods)Create Mod · Mekanism · Advanced Peripherals
  • Events — decide when your logic runs (screen load/update, element events, key press, timer, redstone, modem message, or any OS event).
  • Interfaces — control screens and UI elements at runtime: navigate between screens, get/set element properties, color and option pickers.
  • Programming — the usual language building blocks: control flow, comparisons and boolean logic, math, text, lists, variables, and your own functions.
  • CC: Tweaked APIs — wrappers around the CC: Tweaked APIs so you can drive the computer and the world (terminal, turtle, networking, redstone, files, peripherals, and more).
  • Plugins — extra categories for a mod's peripherals; each only appears when that plugin is enabled for the project.

Note: Interface blocks act on the live UI, so they only do something in Full or UI Only exports.

See also