Windows Lua for executable file

Hi, I have a Lua program (written in Lua 5.1). I am on Windows 7 trying to convert it to an executable. So far no luck. I read other posts here that suggested using srlua for this, so I downloaded it, but I don't understand what to do next. I installed cygwin, as far as I understand, this is necessary, but I do not know how to use srlua to convert a lua file to an executable file. Any help would be appreciated.

+6
source share
1 answer

srlua is distributed only as a source, so you must compile it first (see this answer for suggestions on getting a free C compiler).

By the way, Cygwin is not needed at all. The above link will lead you to instructions for installing TDM-GCC, the Windows port of the GCC compiler that will create executable files that depend only on the default Windows system libraries.

After you have the C compiler and you compiled srlua, you will have two executable files glue.exe and srlua.exe . This last one is just the stub used by srlua.exe to generate the final executable by attaching it to your Lua script.

Assuming your script is myscript.lua and you want to create an executable file called myexe.exe , you should call glue.exe from the command line as follows:

  glue.exe srlua.exe myscript.lua myexe.exe 

I assumed that all the relevant files are placed in the same directory, and you went to that directory from the command line.

Addendum: I just double-checked the official srlua download page , and I saw that there is also a package with binaries already compiled for Windows. Therefore, you can skip the whole compilation from the source part and just download and unzip this .

Binary files are located in the Release subdirectory inside the archive. Note that they are only for Lua 5.1, so if your script uses the Lua 5.2 functions, you should follow my initial advice and compile from the source.

+9
source

Source: https://habr.com/ru/post/952130/


All Articles