Game Development Reference
In-Depth Information
Hello World, the Variable Way
To begin with, we need to start Lua in interactive mode for the purpose of running all of our code.
The way it works is to open a terminal in Mac OS X or *nix, type lua , and press Enter. After doing
this, you should see the screen shown in Figure 1-2 . Under Windows, you can start the Lua console
from the Start menu.
Note
In this topic, most of the screenshots and references will be for the Mac OS X version.
Figure 1-2. The Lua interactive shell running in the terminal on a Mac
The > on the line is the prompt where you can type the Lua code you want to run. We shall start with
writing a simple Hello World example. Type the following at the prompt:
print ("Hello World")
You should see the text “Hello World” printed on the next line. The print function is used to display
the text in the terminal. Let's take this a step further:
 
Search WWH ::




Custom Search