How to run it

1. Online

You can try lua interactively.

2. Docker

Minimal docker image (~10MB):

Dockerfile

FROM alpine:3.15.0

RUN apk update \
    && apk add --no-cache lua5.4

WORKDIR /workdir

ENTRYPOINT [ "lua5.4" ]

hello.lua

print("Hello, World!")

Build and run:

docker build -t lua .
docker run -v "$(pwd)":/workdir lua hello.lua

3. Manual install

Visit lua.org for detailed instructions to build Lua from source.

4. Package

There is also LuaJIT project - a Just-In-Time Compiler for Lua. It can be used as a drop-in replacement for Lua.

MacOS

On MacOS Lua can be installed with Homebrew:

brew update
brew install lua

Linux

On most Linux distributions Lua is available as lua package. On non-rolling distributions like Ubuntu it is preferable to install specific latest version, e.g. lua5.3.

Debian based:

sudo apt update && sudo apt install lua5.3

Arch Linux:

sudo pacman -Syu lua luajit

Fedora:

sudo dnf install lua

Windows

On Windows it can be installed either with luaforwindows project or luarocks all-in-one package.



Next: Variables