Lua by Example: Hello World

Our first program will print the classic “hello world” message. Here’s the full source code.

print('hello world')

To run the above program, put the code in a file named hello-world.lua and use the lua command to run the file like this:

$ lua hello-world.lua
hello world

Now that we can run and build basic Lua programs, let’s learn more about the language.

Next example: Values.