Introduction
The standard method to compile a .lua file into a standalone .exe with a built-in interpreter and no environment dependencies is to use srlua. However, srlua itself has not been updated for over a decade and does not provide precompiled binaries. Many community-compiled versions of srlua overlook dependency issues, resulting in missing DLL errors when running the compiled program on a machine without a Lua environment. Thus, it is not truly ready-to-use.
luaToEXE is an open-source project that wraps srlua, aiming to provide a simple solution for compiling .lua files into .exe files with a built-in interpreter.
Features:
- Easy to use
- The compiled
.exehas no dependencies (tested in Windows sandbox environments) - Supports multiple Lua versions
The project consists of two sub-projects:
- lua-to-exe: A Python library that provides API functions for conversion and a graphical user interface
- exelua: A command-line tool with both 32-bit and 64-bit versions
Links:
Tutorial: lua-to-exe
- Install using
pip install lua-to-exe
Import the package in your project with
import lua_to_exe(note the underscore)-
Graphical interface: Run
lua_to_exe.gui()to launch the GUI- Includes file selection for input
.luaand output.exe, and a convert button - Dropdown to select the Lua version (
-32means 32-bit, and so on)
- Includes file selection for input
- API: Call the
lua_to_exe()function-
lua_to_exe(lua_file, exe_file, lua_version='5.1.5-64'). The arguments are the input.luafile, the output.exefile, and an optional Lua version (default is5.1.5-64) - Call
all_available()to get a dictionary of all available Lua versions
-
Tutorial: exelua
- Download the appropriate version of
exeluafrom the Release page
- Extract and add the directory to your environment variables, then restart your computer. Make sure the
srluafolder is in the same directory
- In the Windows terminal, run
exelua -v. If a version number is output, the installation was successful - Run
exelua -hfor usage help, andexelua -list(the first run may take some time) to list all available versions
- Run
exelua -c <input.lua> <output.exe> [-lua <version>]to perform the conversion. The parameters are: the input.luafile path, the output.exefile path, and the optional-lua(if you want to specify the Lua version) and the corresponding version. For example, to converthelloworld.luatohelloworld.exe, the command can beexelua -c helloworld.lua helloworld.exe, which uses the default5.1.5-64/5.1.5-32Lua interpreter version.
Star Request :-/
If this project has helped you, please consider giving it a Star :)








Top comments (0)