Windows Lua to executable

心已入冬 提交于 2019-11-30 20:42:10
Lorenzo Donati

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

BTW, Cygwin is not necessary at all. The aforementioned link will lead you to instructions to install TDM-GCC, a Windows port of GCC compiler that will create executable files which only depend on Windows default system libraries.

Once you have a C compiler in place and you have compiled srlua, you will have two executable files glue.exe and srlua.exe. This latter is only a stub, used by srlua.exe to generate the final executable by joining it with your Lua script.

Assuming your script is myscript.lua and you want to create an executable named myexe.exe you must invoke 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 changed to that directory from the command line.

Addendum: I just double checked the official download page for srlua and I saw there is also a package with already compiled binaries for Windows. So you could skip all the compilation from source part and simply download and unpack this.

The binaries are in the Release subdirectory inside the archive. Note that these are for Lua 5.1 only, so if your script uses features of Lua 5.2 you must follow my initial advice and compile from source.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!