How to compile Lua 5.3.0 for Windows

Friday, January 16th, 2015 | Dennis D. Spreen | Lua

This is a tutorial on how to compile Lua 5.3.0 for Windows (executable and DLL) with Microsoft Visual Studio Express.

This tutorial on how to compile Lua for Windows is based on the great video How to Manually Install Lua 5.2 on Windows – thank you!

1. download and install Visual Studio 2010 Express (Windows 7) or Visual Studio 2012 Express (Windows 8) – do not use any older/newer version (haven’t tested them)

2. download and extract the Lua 5.3.0 source code

3. open a Visual Studio Command prompt, navigate to the extracted Lua src\ folder and run inside this folder the following commands

You’re done! You should now have a lua.exe interpreter, a luac.exe compiler and a lua5.3.0.dll.


10 Comments to How to compile Lua 5.3.0 for Windows

February 3, 2015

What about sharing the compiled binaries to avoid downloading a 600 MB compiler suite from Microsoft ?

Dennis D. Spreen
February 3, 2015

here you go
If you’d compile it by yourself, you would be able to adjust some settings (luaconf.h) by your needs.

February 4, 2015

x86 and x64 Microsoft Visual Studio 2012 Express Compile

and Thanks for compile tip Dennis.

Roland Chastain
February 5, 2015

Thank you sir! I am very glad to have found your tutorial.

[…] 參考自 How to compile Lua 5.3.0 for Windows P.S. 這篇文章是參考自 Youtube […]

January 5, 2016

Awesome! I was looking for something like this!

March 21, 2016

Thank you, safe me many hours

April 24, 2016

The build script you posted didn’t work properly for me. There were build errors and it didn’t output a DLL. I modified it so it works, and compiles much faster:

del *.obj *.dll *.lib *.o *.exp

cl -MP -MD -O2 -c -DLUA_BUILD_AS_DLL *.c
ren luac.obj luac.o
link -subsystem:console -dll -implib:lua53.lib -out:lua53.dll *.obj
link -out:lua.exe lua.obj lua53.lib
lib -out:lua53-static.lib *.obj
link -out:luac.exe luac.o lua53-static.lib

April 27, 2016

Can someone tell me how I compile the interpreter and the dll for x64?

Leave a comment

About Dennis D. Spreen

I'm an avid programmer working on a variety of platforms in a variety of languages with a wide technical interest.


QR Code