Codecademy Logo

Introduction to Lua


The print() function outputs one or more values to the terminal.

print("Hello, world!")
-- Prints: Hello, world!

Program Structure

The program runs line by line, from top to bottom:

  • Line 1 prints Hola
  • Line 2 prints Buenos días
print("Buenos días")

Single-line Comments

Single-line comments are created using two consecutive forward slashes. The compiler ignores any text after -- on the same line.

-- This line denotes a comment in Lua.

Multi-line Comments

Multi-line comments are created using --[[ to begin the comment, and ]] to end the comment. The compiler ignores any text in between.

This is all commented out.
None of it is going to run!

Learn More on Codecademy