Lua is a delightfully simple language to program in. However setting up Windows to do Lua development can be tricky. This guide walks you through the steps of getting setup with Lua on a Windows PC running Visual Studio Code.
Installing Lua
Create a directory on your PC called C:\lua
. Head on over to Luabinaries and download the latest Windows Executables
zip file. Unzip the file and place the contents in the folder C:\lua\binaries
. You should have three executables and one DLL file.
Copy the luaXX.exe
(where XX is the release number, for example Lua 5.4 would have the executable called lua54.exe
). Paste it in the same directory. Rename it lua.exe
. You should now have a directory listing like the following:
Adding to your PATH
One final task before we can use Lua is to add the location of the executables to your PATH
variable. In your Windows search bar, type in edit the system environment variables
and open the matching application. You should see a window like this:
Click the Environment Variables
button to open the editing window. In this window, select the variable Path
from the User variables
section. Click the Edit
button.
In this new editor window, click the New
button. Type in the text C:\lua\binaries
and press enter. Click the OK
button to leave the settings.
Now open a terminal window by typing terminal
into the Windows search bar and running the application it finds. In the new Terminal window that opens, run the command lua -v
to check the version of Lua that is installed. You should see output like this:
You now have a working Lua interpreter setup on your PC.
Configuring Visual Studio Code
Open VS Code and click on the Extensions
icon on the left-hand side. In the search bar at the top of the extensions list, type in Lua
. Pick the following extension to install:
You now have code completion for the Lua language inside VS Code.
Debugging support
While in the extensions screen, search for Lua local debugger
. Pick the following extension to install:
We need to configure this extension, so open the settings for it and add an entry for your Lua executable as follows:
You now have debugging support for your Lua programs in VS Code.
Top comments (0)