The Comprehensive Guide To Computercraft Simple LUAEdit

This Page is currently NOT finished. it will be uploaded when it is.

Thank you for your patience: 64bitminecraft

Creating and Editting ProgramsEdit

The Computercraft Mod for Minecraft is a mod that brings new programmable blocks into the Game, these can be used to display information or output redstone signals.? Computers come with some default programs, but to make more complex programs, or programs for a specific purpose, you will need to program them yourselves.

to create a new program, or edit an existing one type

edit name

where name is the name you want to give the program.

Now you are ready to make your first program.

Basics of CodingEdit

All of the programs in ComputerCraft revolve around using commands such as:

rs.setOutput("side", boolean)

The print("") command prints the text between the speech marks on the screen and moves to the next line when it's done so.

For example,?

print("Hello world!")
print("Hello world!")

will display the following on your screen.

Hello world!
Hello world!

The write command prints the text between the speech marks on the screen WITHOUT moving to the next line at the end.

For example,

write("Hello world!")
write("Hello world!")

will display the following on your screen.

Hello world!Hello world!


Anything between two quotation marks is a string. Strings are simply lines of characters that the computer will use literally. Ex: "Unicorns", "123456", "Hello world!".

Integers/Numerical valuesEdit

Integers are any numbers that aren't a string. The main difference being that Integers can have mathematical attributes applied to them (Such as a number being greater than another number, or basic arithmetic functions)

Ex: 2, 5.6, -18000.

Note: "1" is NOT the same thing as 1. "1" is a string, where 1 is an integer.


?  ? You can think of variables as buckets that hold information. When you need to store some information, you throw it in a bucket. And when you want to store different information in the bucket, it's easy to dump out the old information, and put in brand new information.

Variables are defined in programs like this:

(Note: The < and > are to denote groupings. Don't include them in the actual code.)

<variable name> = <something>

Variables can be named single letters, words, and they can include letters and most symbols. Generally, variables are equal to strings and integers, but they can also reference other variables.

x = 1
y = x
Hello = "World!"
z = "Unicorns"

You can use them in commands like below:

print(x.."This is a string!")




When using them in commands like this, note the absence of quotation marks around the variables. This denotes these characters as variables instead of strings.?

Also, notice that when linking variables and strings, or when variables are linked to other variables in a print/write command, it is necessary to add a ".." in between them.

User InputEdit

? Now, by itself, the print command would be a nice way to make a digital book. But, for more interesting and complex programs, it becomes necessary for the user to input certain information into the program.?

name =

In this code, the variable "name" is equal to "". prompts the user to type in some sort of information, and stores this information as a string equal to the variable. In this case, if I input "Ryan" when it asks me to, the variable "name" will be set equal to "Ryan", and whenever it is referenced, it will continue to equal "Ryan" until it's changed.


In much the same way as, the command os.pullEvent() allows for user input, and is stored as a variable, or multiple variables (depending on what event is triggered).

Click here for more information on events.