A guide for compiling Lua for Windows, complete with script
- A tool capable of extracting .tar.gzfiles- I recommend 7Zip
 
- Either
- A full Visual Studio installation
- The standalone Visual Studio build tools (unconfirmed)
 
- Go to the Lua download area.
- Download the version of Lua that you want.
- Unzip the .tar.gzfile using a decompression tool, giving you a folder of the formlua-x.y.z.- Where x.y.zcorresponds to the version number of the Lua version you have downloaded, e.g.lua-5.3.5.
- If you do not have a suitable decompression tool, I recommend 7Zip.
- You may need to extract twice, once for the .gzwrapper and once for the.tararchiving.
 
- Where 
- Download the Compile.batfile from this repo and move it into the extractedlua-x.y.zfolder.
- Make sure you have cl.exe,link.exeandlib.exeeither in your%PATH%variable or in the extractedlua-x.y.zfolder.
- Run Compile.bateither by double-clicking it or running it from command line.- Windows may provide a security warning advising you not to run scripts from untrusted sources. If you have any doubts about whether or not you can trust the script then I advise that you do not run it as I will not be held liable for any damages.
 
After step 6, there should be a copy of lua.exe, luac.exe and lua.dll present in the lua-x.y.z folder.
- lua.exeis the Lua interpreter, which interprets and runs scripts, and provides a Lua REPL if run without arguments.
- luac.execompiles Lua files into standalone executables.
- lua.dllis the library file that holds all the necessary Lua pipelining and must be kept with both- lua.exeand- luac.exein order for them to function correctly.
You may relocate these files as you please, as long as lua.exe and luac.exe have a copy of lua.dll in the same directory in which they are kept.
It is recommended that you put the directory in which these files are kept on your %PATH% so that you can run them from the command line.
The script I have provided is a modified version of the script found on this blog. I am not the original author, but I am responsible for the various modifications. Regretably as the original script has no licence I cannot provide a licence for my modified version as I do not have proper copyright of it. The original author retains the right to request the removal of my modified version, a request with which I would willingly (if regretfully) comply, but personally I would rather the original author added a proper licence to their original version and possibly even incorporated my modifications, as that would be a more beneficial outcome.
Regardless I will say that:
This software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.