Installing Lua

Installing Lua on Windows, macOS, and Linux

Lua is a lightweight, fast, and embeddable scripting language commonly used in game development, embedded systems, and configuration scripting. If you're getting started with Lua, the first step is to get it installed on your machine. Here's how you can install Lua on Windows, macOS, and Linux.

Installing Lua on Windows

There are multiple ways to install Lua on Windows, but the most straightforward is using LuaBinaries or Chocolatey.

Method 1: Using LuaBinaries (Manual Installation)

  1. Go to https://www.lua.org/ftp/
  2. Download the latest Lua Windows binaries (e.g., lua-5.4.x_Win64_bin.zip)
  3. Extract the zip to a folder (e.g., C:\Lua)
  4. Add the Lua folder to the system PATH:
    • Search for “Environment Variables”
    • Edit the Path variable and add: C:\Lua

Method 2: Using Chocolatey (Recommended for Power Users)

If you have Chocolatey installed:

choco install lua

Verify the installation:

lua -v

Installing Lua on macOS

macOS users can install Lua easily using Homebrew.

Step-by-Step via Homebrew

  1. Install Homebrew (if you haven’t already):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. Use Homebrew to install Lua:
brew install lua
  1. Check the installation:
lua -v

Installing Lua on Linux

The Lua package is available in most Linux distribution repositories.

On Ubuntu / Debian-based systems:

sudo apt update
sudo apt install lua5.4

On Fedora:

sudo dnf install lua

On Arch Linux / Manjaro:

sudo pacman -S lua