Starting with Lua on Windows 10

Lua is a light script programming language. Mostly it’s used as embedded language in different areas: game dev, stock trading, etc.

In this article you will find how to install your Lua development environment on Windows 10.

Download and install Lua

I recommend you to use all-in-one Lua package from Download the last version from the list (at the moment it’s LuaForWindows_v5.1.4-46.exe). Also you need vcredist executable file ( vcredist_x86.4053.exe ).

Install vcredist first and Lua package after that. Use default settings during installation process.

Update environment paths

For proper work you need to update your environment variables. Go to Control Panel -> System -> Advanced system parameters -> Environment variables. Add following variables values:

LUA_CPATH = C:\Program Files (x86)\Lua\5.1\clibs\?.dll;C:\Program Files (x86)\Lua\5.1\clibs\luasql\?.dll

LUA_DEV = C:\Program Files (x86)\Lua\5.1 
LUA_PATH = C:\Program Files (x86)\Lua\5.1\lua\?.luac;C:\Program Files (x86)\Lua\5.1\lua\?.lua  

Editing code

You can use any text editor for writing Lua code. Default editor from all-in-one package is SciTE. I recommend you to use SciTE because it has code highlight and code debug features.

Let’s create your first Lua script. Run the editor and and just one line to a new file:

print "Hello from Lua!"
SciTE Lua Hello World

Save the file and run it from command line:

C:\lua>lua hello_world

You should see line

C:\lua>lua hello_world
Hello from Lua!
Lua Hellow world output

Here we are! Your Lua development environment is ready. Check other articles under “Lua” tag in my blog to know more Lua tips and tricks.