Name already in use
This guide will explain the basics of using Lua on Windows.
Compiling from Source using MinGW
The latest version of MinGW needs to be installed on the system
MinGW is a project that brings many of the developer tools from linux to windows, including tools like make and gcc .
To get started, download and install the latest version of MinGW. More precisely, you will need mingw-get , which is a tool to install various mingw packages.
Take note of the installation directory; after the installation is done, this should contain a few folders like lib and include , but most importantly, bin .
In the MinGW Installation Manager, install at least the packages mingw32-base and mingw-developer-toolkit .
Download the Lua sources
The source code of Lua needs to be downloaded from lua.org
Next, download the source files from lua.org. Once you have downloaded the source code, packaged as a .tar.gz file, unpack it all into a new folder, for example %HOME%/workspace/ (where %HOME% stands for your users home-folder).
By default, windows has no program to extract .tar.gz files, you could use a graphical tool like 7Zip, or the linux tool tar , installed via MinGW.
The .tar.gz archive should contain a single folder, named lua-<version> (Where <version> is Luas version number). After extracting it, open this folder on the command line, either by opening a new command-line window and navigating to the folder, or from the windows explorer.
How do I do that?
To open a directory in a commandline window:
- Holding shift, right-click the folder you want to open
- Click on Open command window here or Open PowerShell window here
- A commandline window should now appear running either cmd or powershell ( ps )
- If you clicked on the PowerShell option, type cmd and press enter
mingw32-make needs to be called in the project directory
Make sure you’re in the right directory by typing dir and looking for the src and doc folders, as well as the Makefile and README files.
Temporarily add MinGWs bin folder to your path variable, if you haven’t already configured this for your user account:
In the commandline window, type set PATH=C:\MinGW\bin:%PATH% assuming you installed MinGW under C:\MinGW (see installation step). Otherwise, replace C:\MinGW your chosen MinGW installation directory.
Now you should be able to compile Lua by typing mingw32-make mingw .
If this step completes without errors, the following new files should have been created in the src folder:
lua53.dll This is really the main «Lua» library, which contains all that’s needed for another program to run Lua code. lua.exe This program uses the lua53.dll to load and run Lua code. It is usually the main way for users to run Lua scripts. luac.exe This program compiles Lua source code to Lua byte code. This is different from compiling, for example, a C program to machine code, in that you still need the Lua interpreter to run the program, but it should load considerably faster, as it is already converted to a binary format that the Lua VM can directly interpret.
the make task «install» needs to be called
To install Lua on your system, after running make to compile the files, run mingw32-make install INSTALL_TOP=’C:\Lua’ .
By replacing «C:\Lua» with any other directory, you can change where the files will be installed to, for example, you can install Lua to ‘C:\Program Files\Lua’ .
Adding Lua to the PATH variable
The bin subdirectory needs to be added to the PATH environment variable
If you want to call Lua on the command line without having to type the full path, you will have to add its bin directory to your PATH variable.
To do this open the start menu by pressing the windows key and type «environment variables». To add the path for all users, choose the option to modify system environment variables. If you want this just for yourself, choose the option to modify environment variables for your account.
In the list, find and double-click the variable called PATH .
In windows 10, you should get a simple UI with a table layout. Click new and type (or copy) the path to your Lua installation directory, followed by \bin . For example, this could be C:\Lua\bin .
When using windows 7, the UI looks a mit different, and you will only get a big text-box. Scroll to the beginning of the text box (you can just hold the left arrow for this) and type in the path to the bin directory as described above. Then add a ; at the end to separate it from the next path.
Installing Luarocks as a standalone executable
If you’re installing Lua, chances are, you will want to install additional functionality from the internet. Currently, the main way of distributing Lua modules easily is using Luarocks.
The easiest way to install luarocks on Windows is to get the standalone executables. These are just two .exe files that contain everything you need to run luarocks.
- Open https://luarocks.org in your browser
- Click «install» on the navigation bar at the top
- Choose one of the two «all-in-one executable» options
- Click the link and download the file
- Unzip the two executables into a directory of your choosing
The two executables can be saved in any directory you want, but it would make sense to place them either in Luas bin directory or give them their own subdirectory in C:\Program Files
Installing Luarocks from Source
For a variety of reasons, you may want to compile LuaRocks from source. To do this, follow the following steps:
- Open github.com/luarocks/luarocks
- Click the clone or download button
- Click Download ZIP and download the file
- Unpack the ZIP file wherever you like
- Within the folder you just unpacked, open a new commandline
- Run the command install.bat /LUA C:\Lua
Where C:\Lua should be replaced with Luas install directory.
Installing LuaSocket and LuaSec via Luarocks
LuaSocket is a very common Lua module that allows communication over the network (LAN networks or the Internet) using a set of common protocols like TCP, UDP or HTTP.
If you already have MinGW installed, you should be able to just install LuaSocket by running
luarocks install luasocket
on the commandline.
To use secure protocols like HTTPS, you additionally need the LuaSec module.
For this, you first need to install the OpenSSL library, which is originally a linux library that implements several cryptographic algorithms and protocols.
Most sources recommend the Win32/Win64 OpenSSL installer for windows from the Shining Lights Productions website. During the installation, take note of the installation directory.
After openssl has been successfulyl installed, run luarocks install luasec OPENSSL_INCDIR=’C:\path\to\openssl\include’ , where «C:\path\to\openssl» should be replaced with OpenSSL install directory.
Getting started
Lua is a powerful and fast programming language that is easy to learn and use and to embed into your application.
Lua is designed to be a lightweight embeddable scripting language. It is used for all sorts of applications, from games to web applications and image processing.
See the about page for details and some reasons why you should choose Lua.
See what Lua programs look and feel like in the live demo.
A good place to start learning Lua is the book Programming in Lua, available in paperback and as an e-book. The first edition is freely available online. See also course notes based on this book.
The official definition of the Lua language is given in the reference manual.
See the documentation page and the wiki for more.
Our community is friendly and will most probably help you if you need. Just visit the mailing list, the chat room, and stackoverflow.
If you need help in Portuguese, join the Lua BR mailing list and visit pt.stackoverflow.
See also the FAQ, the community-maintained wiki and LuaFaq, and the much longer uFAQ.
If you need to complement the standard Lua libraries to handle more complex tasks, visit LuaRocks, the main repository of Lua modules. See also Awesome Lua, a curated list of quality Lua packages and resources. The lua-users wiki lists many user-contributed addons for Lua.
You can help to support the Lua project by buying a book published by Lua.org and by making a donation.
You can also help to spread the word about Lua by buying Lua products at Zazzle.
Use the live demo to play with Lua if you don’t want to install anything on your computer.
To run Lua programs on your computer, you’ll need a standalone Lua interpreter and perhaps some additional Lua libraries. Pre-compiled Lua libraries and executables are available at LuaBinaries. Use your favorite text editor to write your Lua programs. Make sure to save your programs as plain text. If you want an IDE, try ZeroBrane Studio.
If you use Linux or Mac OS X, Lua is either already installed on your system or there is a Lua package for it. Make sure you get the latest release of Lua (currently 5.4.4).
Lua is also quite easy to build from source, as explained below.
Lua is very easy to build and install. Just download it and follow the instructions in the package.
Here is a simple terminal session that downloads the current release of Lua and builds it in a Linux system: If you don’t have curl, try wget.
If you use Windows and want to build Lua from source, there are detailed instructions in the wiki.
How to install Lua on windows
I’m new to Lua, and need to know how to install it on Windows?
I’ve tried and am unable to run the sample. When I try to compile it 100% success is shown, but when I click the run button it shows this error:
If anyone can help me on how to install Lua, thanks.
![]()
2 Answers 2
Lua does not have a certified IDE or compiler to come with it. You usually run lua code from a lua command line / lua file which will handle the tasks you are attempting to create.
Downloading
Lua has a website where you can download their tools which will allow you to write and execute lua code: https://www.lua.org/download.html
Using lua console
After you download the file, put it in a file location anywhere on your computer, in order execute lua code; the first method is to open the lua console and simply type out your command: https://prnt.sc/ibw97h
Another method you can use, is make a .txt or .lua file, write your code in that, then you can drag and drop the file onto the lua console to execute it: https://prnt.sc/ibwa2f
Installing lua system wide
Add lua in the environment variables by adding the path from where it’s installed. After doing this you can open PowerShell and enter lua53.exe to open lua.
Additional details
Although these is what lua directly offers, there are other third party alternatives of compiling and executing lua code. Examples of these can be found if you search for them.
How to Install Lua on Windows 10 (lua tutorial)

Lua is a powerful, efficient, lightweight, embeddable scripting language. It supports procedural programming, object-oriented programming, functional programming, data-driven programming, and data description.
In this Lua Tutorial we will Learn How to Install Lua on Windows 10 (Lua tutorial)
What is Lua Used For ?? Lua combines simple procedural syntax with powerful data description constructs based on associative arrays and extensible semantics. The Lua Interpreter is dynamically typed, runs by interpreting bytecode with a register-based virtual machine, and has automatic memory management with incremental garbage collection, making it ideal for configuration, scripting, and rapid prototyping.
However Lua Ide |Lua vs Python|Why to Choose Lua Lua has a deserved reputation for performance. To claim to be “as fast as Lua” is an aspiration of other scripting languages. Several benchmarks show Lua as the fastest language in the realm of interpreted scripting languages. Lua is fast not only in fine-tuned benchmark programs, but in real life too. Substantial fractions of large applications have been written in Lua.
Basic Steps (How to install Lua)
There are many simple steps to Download Lua and Install Lua on your Window10……
Step 1:How to Install Lua on Windows 10 manually
Firstly, What you have to do is to Open your Browser and Write Lua on the Search Bar……

How to Install Lua on WIndows 10
Similarly Click on Lua :Getting Started to Download the Lua on your windows 10.
Moreover As you are watching in the figure below.
How to Install Lua
Similarly Now you will reached to the site from where yo will Install the Lua for your Windows 10
However Above is the Link Address to download Lua
Moreover Below in the Figure you will understand better how it be done.

Similarly A new page of Lua.org will be open after clicking on the Installing Button.
However On the Lua.org page you will find
Lua Dist link to download Lua from Lua.org Page.
Moreover you will understand by the Figure below

How to Install Lua
However On the next page you will see the options .
Moreover You have to Select the option which you want as illustrated in the figure below
However As I have Selected the option of Widows

How to Install Lua on Windows
Similarly A Popup of Start Download will appear on your Screen

How to Install Lua
When You Click on the Start Download Button It will start downloading.
A downloading Popup will appear on your screen.
How to Install Lua
How to Install Lua | Step 2
In the Second Step What we have to do is to download the language .
Write Lua Language on the search bar of your search engine.
Select The Programming Language Lua Link to download the Language of Lua.
You can also use the link
Take a look on the Figure Below
How to Install Lua
Below the context you will see option to download Lua Language in form of Link

On the next Page you have to Click on the binaries Option to Download the binary of Lua
How to install Lua
A download popup will display on your desktop.
Just Open the Downloaded File of Binaries. As Illustrated Below

How to Install Lua
Lua Tutorial :Learn how to Install Lua Step 3
Now You have a complete downloaded file of Lua and Lua Binaries.
- Go to your system Downloads.
- In Downloads Select the Compressed folder.
- Unzip the Binaries Folder and extract all the Files .
- You can see below how it be done.
Above the Binary Folder is Selected and Below is the File Extraction as shown in the figure below.

How to Install Lua
Now a Popup will be displayed on your screen which will extract the Files from the Folder.
Extraction process popup shown in the figure below

How to Install Lua
Installing Lua Tutorial| How to Install Lua on Windows 10 : Step 4
After the extraction you will find a extracted folder in the same list like you can see the picture below .
Point To Remember
Now here you have to Change the folder name which contains extracted files or if you dont want to change the folder name no Problem .

How to Install Lua
Simply you have to copy the above folder in the C Directory.
Press Ctrl+C to copy the Folder.

How to Install Lua
Now Click on C Directory and past the copy folder or Press Ctrl+V.
Below the Popup show the process of copying Folder into C Directory

Step by Step Tutorial To Install Lua | Lua Tutorial :Step 5
- Now Click on Lua Folder.
- You will see bin Folder Click on it.
- Now You have to copy the address from this bin
- How to copy the address is shown in Figure below
Lua Installation Tutorial|How to Install Lua on Windows 10 : Step 5
In the previous step you copied the address
- Go to you Desktop
- Right Click on the ThisPc icon on the Desktop
- You will see the small popup
- Single Click on Properties Similarly and you are opening the properties of your desktop
- Click on the Advanced system settings
- See in Figure
How to Install Lua on Windows 10 :Step 6
After Click on the Advance System Settings A popup of System Properties will display on your Screen
Click on the Environment Variables as shown in the Figure
How to install Lua
After Clicking on Environment Variables A Environmental Variable Popup will be displayed on your Screen
Click on the Path to Select the Path
Click on Edit Button to edit the path as Shown in Figure Below
How to Install Lua
Now A popup of Edit Environmental Variables will display on your Screen
Click on New Button to Edit /Paste your copied Path
How to install lua
For-instance This could be like this as shown in the picture below when to click on the New Button
Moreover Above in the circle of Picture you have to Paste the copied Address which we copied previously from Bin Folder in this Lua tutorial
How to Install Lua