Install Lua on Windows
Installing Lua on Windows is straightforward using pre-compiled binaries or through package managers like Chocolatey and Scoop.
Using Chocolatey (Recommended)
Chocolatey is a popular package manager for Windows that makes installing Lua simple.
Install Chocolatey if you haven’t already:
- Open PowerShell as Administrator
- Run:
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
Install Lua:
choco install lua- Verify installation:
lua -vUsing Scoop
Scoop is another excellent package manager for Windows:
Install Scoop if you haven’t already:
- Open PowerShell as Administrator
- Run:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser - Run:
irm get.scoop.sh | iex
Install Lua:
scoop install luaManual Installation
If you prefer manual installation or need a specific version:
- Download Lua from the official website
- Extract the ZIP file to a location like
C:\lua - Add
C:\luato your system PATH environment variable - Open Command Prompt and verify:
lua -vUsing MSYS2/MinGW
For developers who prefer a Unix-like environment:
- Install MSYS2 from msys2.org
- Open MSYS2 MinGW 64-bit terminal
- Install Lua:
pacman -S mingw-w64-x86_64-luaVerifying Installation
Test your installation by creating a test file:
- Create a file named
test.luawith this content:
print("Hello from Lua on Windows!")
print("Lua version:", _VERSION)
print("OS:", package.config:sub(1,1) == "\\" and "Windows" or "Unix")- Run it from Command Prompt:
lua test.luaUsing Lua in Windows
Once installed, you can use Lua in several ways:
Command Line:
lua script.luaInteractive Mode:
luaCompile to Bytecode:
luac script.luaIDE Integration
Windows IDEs with excellent Lua support:
- Visual Studio Code: Install the “Lua” extension
- Notepad++: Install the “Lua” language plugin
- Sublime Text: Use the “Lua” package
- ZeroBrane Studio: Dedicated Lua IDE with debugger
Common Windows Issues
PATH not found: Restart Command Prompt or PowerShell after adding Lua to PATH.
Permission denied: Run Command Prompt as Administrator when installing to system directories.
DLL errors: Ensure Visual C++ Redistributable is installed, usually included with Windows 10/11.
Next Steps
With Lua successfully installed on Windows, you can start exploring our Lua basics tutorials or install LuaRocks for package management.
For Windows-specific Lua discussions and support, check the Lua mailing list.