Tutorial/Hello World

The Hello World application is the first program that (most) programmers write when starting with a new programming language, it's perfect to see the behaviours of a new programming language or platform.

First step: Create a new file

There are 2 ways to create a new file in Craft OS, you either use the "lua" program to get into a small terminal in which you can practice your Lua skills, or you use the "edit" program to create a new file, which can be run over and over.

In this case we will create a new file, by using the command: "edit HelloWorld", this will create a new program called HelloWorld. You are now in the editor, you can type, or use the ctrl key to open up a small menu, we'll be looking at the menu later.

The Code

In the editor, type:

print("Hello World")

Now you're probably thinking: What did I just do? Well, you just created your first program! Print is a statement(command) that lets you print a text into the terminal, the ("Hello World") part says what should be printed out.

Playing your program

To play your program, simply press ctrl, highlight the text "Save" by using the arrow keys, hit enter, then press ctrl again, use your arrow keys to highlight the text "Exit", press enter, and now you're back in the terminal. Now type HelloWorld, or however you called your program.

Voila! Was that so hard? Now if you want to go back into the editor, simply run the program edit HelloWorld again, try to play around a bit, or (if available) go to the next Lua Tutorial!


Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Need wiki hosting?

Do you need a wiki for your Minecraft mod/gaming wiki? We'll host it for free! Contact us.

Other wikis

Indie-game wikis
Powered by Indie Wikis