https://github.com/vorgestern/srlua
Tool to create executable from Lua script
https://github.com/vorgestern/srlua
binary lua runtime tool
Last synced: about 1 month ago
JSON representation
Tool to create executable from Lua script
- Host: GitHub
- URL: https://github.com/vorgestern/srlua
- Owner: vorgestern
- License: mit
- Created: 2024-12-15T20:18:04.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-09-15T18:24:25.000Z (9 months ago)
- Last Synced: 2025-09-15T20:12:24.961Z (9 months ago)
- Topics: binary, lua, runtime, tool
- Language: C++
- Homepage:
- Size: 23.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Purpose
Turn a Lua script into an executable.
Inspired by Luiz Henrique de Figueiredo's
[srlua](https://web.tecgraf.puc-rio.br/~lhf/ftp/lua/index.html).
Further scripts loaded with dofile or require will not be embedded,
but can still be found if `LUA_PATH` or `LUA_CPATH` are set appropriately.
# How to use
srlua add.lua Will create ./add.exe (Windows) or ./add (Linux), embedding add.lua.
./add 21 22 Will execute the embedded script, passing the arguments.
srlua add.lua other.exe Will create ./other.exe instead.
luac -o temp add.lua
srlua temp add.exe Will embed bytecode, error messages still refer to the original script.
./add a b
add.lua:5: arg1 ('a') is not a number!
stack traceback:
[C]: in function 'error'
add.lua:5: in main chunk
# Improvements over the original
- No need for a second executable, srlua is a standalone solution.
- Improved error messages from embedded scripts by embedding the script name along with its content.
- Rewritten in C++
- Windows build
# How to build
## on Windows
Edit buildsys/VS17/Lua.props Set AdditionalIncludeDirectories, AdditionalDependencies
and AdditionalLibraryDirectories according to your
Lua-Installation.
Open buildsys/VS17/SRLua.sln Build Configuration Release/32bit
Release/32 bits will be built in repository root.
## or on Linux
Use Makefile
make Will make srlua and compile add.lua to ./add