Hello World in Lua

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

print("hello world")

To run the program, save the code in a file named hello-world.lua and use the lua command to execute it.

$ lua hello-world.lua
hello world

Lua is an interpreted language, which means you don’t need to compile it like some other languages. You can run the Lua script directly using the interpreter.

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