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
.exe
has 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
.lua
and output.exe
, and a convert button - Dropdown to select the Lua version (
-32
means 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.lua
file, the output.exe
file, 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
exelua
from the Release page
- Extract and add the directory to your environment variables, then restart your computer. Make sure the
srlua
folder is in the same directory
- In the Windows terminal, run
exelua -v
. If a version number is output, the installation was successful - Run
exelua -h
for 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.lua
file path, the output.exe
file path, and the optional-lua
(if you want to specify the Lua version) and the corresponding version. For example, to converthelloworld.lua
tohelloworld.exe
, the command can beexelua -c helloworld.lua helloworld.exe
, which uses the default5.1.5-64
/5.1.5-32
Lua interpreter version.
Star Request :-/
If this project has helped you, please consider giving it a Star :)
Top comments (0)