Follow these steps to install Lua on your Windows system:
-
Download LuaBinaries:
Visit LuaBinaries and download the latest version suitable for your system (32-bit or 64-bit). -
Download LuaDist:
Go to LuaDist Repository and download the package management system for windows.
- Extract both LuaBinaries and LuaDist files using an unzip tool (e.g., WinRAR, 7-Zip, or the built-in Windows utility).
- Create a folder named Lua in the root of your C: drive (e.g., C:\Lua).
- Copy all the content from both extracted folders into this Lua folder.
To make Lua accessible from anywhere in the command line:
- Press Windows + R, type sysdm.cpl, and hit Enter.
- In the System Properties window, go to the Advanced tab and click Environment Variables.
- Under User variables, locate and select the variable named Path. Then, click Edit.
- In the Edit Environment Variable window, click New, and paste the path to Lua's bin folder: C:\Lua\bin
- Click OK to save your changes, and close all dialog boxes.
- Open a Command Prompt.
- Type lua and hit Enter.
- If Lua is installed correctly, you'll see the Lua version and the Lua interactive shell prompt (e.g., >).
- If you don't see this, double-check the installation steps and ensure the Path variable is correctly set.
- Save your Lua scripts with the .lua extension and run them in the command prompt using the lua .lua command.
- Refer to the official Lua documentation at Lua.org for further guidance and learning resources.