Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How Do I Build Lua For Windows Using MinGW and MSYS?

I have a book called Beginning Lua Programming which is suppose to go over the raw basics but it is sort of leaving me stranded. Here is an effort to condense 3 pages:

QUOTE:

The following environment variables are recommended for Windows:
UTIL_DIR=c:\program files\utility
LUA_DIR=c:\program files\lua\5.1
LUA_CPATH=?.dll;%LUA_DIR%\?.dll
LUA_PATH=?.lua;%LUA_DIR%\?.lua
The UTIL_DIR variable identifies the utility directory you created in the preceding section. 

After this, there is a segment about setting the 'windows search path' for lua. Basically, it tells me to look up the output of 'doskey /?' and 'path' and figure it out myself. I have no idea what these do, how to use them, and what the difference between them is.

I'm at my wits end. A detailed explanation or a link to a detailed blog/article or youtube video is EXTREMELY appreciated!

like image 220
user2316667 Avatar asked May 20 '13 02:05

user2316667


People also ask

Does Lua work on Windows?

Overview. Lua for Windows is a 'batteries included environment' for the Lua scripting language on Windows. Lua for Windows (LfW) combines Lua binaries, Lua libraries with a Lua-capable editor in a single install package for the Microsoft Windows operating system.


1 Answers

There are a few ways to get Lua working on your machine. If you just want to a functional Lua environment in a hurry with minimal fuss then consider downloading one of the precompiled Lua binaries. The common ones being Lua for Windows and LuaBinaries.

Building Lua with Mingw isn't too difficult:

  • First get your desired Lua version here.
  • Extract the tar file containing Lua's source somewhere. For this example, I'll assume you extracted to c:\lua
  • If you have Msys already set up, you can run the make file from that environment. From the Msys shell, you can build lua with the follow commands:

    cd /c/lua
    make PLAT=mingw
    make install
    
  • You should find lua.exe and luac.exe somewhere in there after the build completes. Lua should be ready for use at this point.

The regular cmd.exe shell can work too with some changes to the commands:

    cd lua
    mingw32-make PLAT=mingw

The make install assumes a *nix environment and so doesn't work under a normal windows cmd shell. In this case you can just manually copy the compiled files from .\lua\src to where you want or you can just run it directly from there if desired.

like image 87
greatwolf Avatar answered Sep 21 '22 02:09

greatwolf