Jump to content
Search

This wiki is under development. Features may be missing. Data loss is unlikely, but possible. Read the announcement.

Lua

From Ubuntu Wiki

Lua is a lightweight scripting language. It is commonly embedded in other software.

Examples of popular software that embed Lua include the Neovim text editor and the Defold game engine.

Install

To install version 5.5 of the Lua interpreter:

sudo apt install lua-5.5

When developing programs that use the Lua C API, you'll also need liblua.

sudo apt install liblua5.5-dev

REPL

Run lua with no arguments to start the interpreter:

$ lua

Lua 5.5.0  Copyright (C) 1994-2025 Lua.org, PUC-Rio
> print("hello")
hello

Run a program

Create a simple hello.lua:

print("hello")

To run the program:

lua hello.lua