Skip to content
ebernerd edited this page Jul 23, 2016 · 8 revisions

Welcome to the Cobalt Wiki

Here you can learn how to use the callback wrapper for ComputerCraft. If you've used Love2D before, you will be familiar with the way Cobalt works.

Install Cobalt by running pastebin run h5h4fm3t in your computer's shell. If you want an unstable but tech preview of the next update, you can type pastebin run h5h4fm3t beta.

You can see the changes in the changelog

Getting Started

To get started, you must include the Cobalt wrapper into your file. You can do that by downloading the main cobalt file, and placing it wherever you'd like in your ComputerCraft filesystem (you will need the absolute path of it to use it, however). Then, open your new Cobalt project (an empty file) and place:

local cobalt = dofile( "path/to/cobalt" )

You then need to include all of the callbacks:

function cobalt.update( dt )

end

function cobalt.draw()

end

function cobalt.mousepressed( x, y, button )

end

function cobalt.mousereleased( x, y, button )

end

function cobalt.keypressed( keycode, key )

end

function cobalt.keyreleased( keycode, key )

end

function cobalt.textinput( t )

end

After all your code is ready, you can validate it by trying to run it. If no errors pop up, your code is at least ready to run!

To initialize your program, make sure you include this snippet on the last line of your program:

cobalt.initLoop()

This starts the callback wrapper for Cobalt to work. You can learn how it works here.