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.

Tags:

13 Comments to How to compile Lua 5.3.0 for Windows

Kochise
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 lua5.3.0.zip
If you’d compile it by yourself, you would be able to adjust some settings (luaconf.h) by your needs.

Sweet
February 4, 2015

x86 and x64 Microsoft Visual Studio 2012 Express Compile
http://1drv.ms/1DEAkLw

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 […]

Carl
January 5, 2016

Awesome! I was looking for something like this!

muminoi
March 21, 2016

Thank you, safe me many hours

VG
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

lamonese
April 27, 2016

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

[…] Anleitung: von Dennis D. Spreen, diese bezieht sich auf Visual Studio 2010/2012 aber es sollte auch mit der aktuellen VS Version […]

busyBeaver
July 4, 2016

Hi lamonese,
I build 64-bit Lua with VS2014/15 (win10). You find the hints (written in german) here:

* how to prepare VS : https://lua64bit.wordpress.com/2016/07/03/wie-erstelle-ich-mit-vs-ein-64-bit-modul/
* build 64-bit lua: https://lua64bit.wordpress.com/2016/07/03/selfmade-lua/

Hosting Deutschland
July 18, 2016

To keep with Lua’s dynamic nature Ravi uses a mix of compile type checking and runtime type checks. However due to the dynamic nature of Lua, compilation happens at runtime anyway so effectually all checks are at runtime.

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.

Search

QR Code

Categories