A modified version of ReiLua with embedded main.lua, embedded assets, splash screens, and asset loading system
This is an enhanced version of ReiLua featuring:
- Embedded Lua Support - Bundle all your Lua code into a single executable
- Embedded Assets - Package images, sounds, and other assets into your game
- Splash Screens - Customizable startup screens featuring Raylib and ReiLua
- Asset Loading System - Loading screen with progress tracking
- Automated Build Scripts - One-command development and release builds
- Console Control - Debug logging system for development
- macOS Support - Build for macOS with static linking (see MACOS.md)
- Project Creation Tool - Automated project setup with metadata embedding
ReiLua brings the power and simplicity of Raylib to the beginner-friendly Lua language in a straightforward manner. It is a loose binding to Raylib - some functions are excluded and some are added. The concept of pointing to a "main.lua" file and accessing functions "init", "update", and "draw" is borrowed from the Löve game framework.
Note: ReiLua is lovingly handcrafted and will likely contain bugs and documentation errors, so it would be much appreciated if you would report any such findings.
Reilua means "fair" in Finnish.
This enhanced version is built upon:
- Raylib (v5.5) - A simple and easy-to-use library to enjoy videogames programming
- Created by Ray(Ramon Santamaria) (@raysan5)
- Licensed under the zlib/libpng license
- ReiLua - The original Lua bindings for Raylib
- Created by Jussi Viitala
- Licensed under the MIT license
- Lua (v5.4) - Powerful, efficient, lightweight, embeddable scripting language
- Embedded Lua and asset support system
- Splash screen implementation
- Asset loading progress API with retro UI
- Build automation scripts
- Console control system
- Comprehensive documentation
- Raygui - Immediate mode GUI library
- Raymath - Math utilities for game development
- Lights - 3D lighting system
- Easings - Easing functions for smooth animations
- RLGL - OpenGL abstraction layer
- Oleaguid - Custom pixel art font for splash and loading screens
ReiLua is WIP and some planned raylib functionality is still missing, but it already has over 1000 functions. Current Raylib version is 5.5.
- Raygui
- Raymath
- Lights
- Easings
- RLGL
List of some MISSING features that are planned to be included:
- Core
- VR stereo config functions for VR simulator
- v0.9
- Stability improvements
- Additional raylib bindings
- v1.0
- raylib 6.0 support
Development Mode (Fast Iteration):
# 1. Create your game files GameFolder/ ├── main.lua ├── assets/ │ ├── player.png │ └── music.wav # 2. Run ReiLua pointing to your game folder ReiLua.exe GameFolder/ # Or from your game foldercd GameFolder path/to/ReiLua.exe # Skip splash screens during development ReiLua.exe --no-logo # Enable console for debugging ReiLua.exe --log --no-logoRelease Mode (Single Executable):
# See "Building for Release" section belowCreate a main.lua file:
localtextColor=RL.BLACKlocaltextPos={192, 200 } localtextSize=20localtext="Congrats! You created your first window!"functionRL.init() RL.SetWindowTitle( "First window" ) RL.SetWindowState( RL.FLAG_VSYNC_HINT ) endfunctionRL.update( delta ) ifRL.IsKeyPressed( RL.KEY_ENTER ) thenlocalwinSize=RL.GetScreenSize() localmeasuredSize=RL.MeasureTextEx( RL.GetFontDefault(), text, textSize, 2 ) textColor=RL.BLUEtextPos={winSize[1] /2-measuredSize[1] /2, winSize[2] /2-measuredSize[2] /2 } endifRL.IsKeyPressed( RL.KEY_SPACE ) thentextColor=RL.REDtextPos={192, 200 } endendfunctionRL.draw() RL.ClearBackground( RL.RAYWHITE ) RL.DrawText( text, textPos, textSize, textColor ) endRun it:
ReiLua.exe --no-logoReiLua looks for a 'main.lua' or 'main' file as the entry point. There are seven Lua functions that the framework will call:
RL.init()- Called once at startup for initializationRL.update(delta)- Called every frame before draw, receives delta timeRL.draw()- Called every frame for renderingRL.event(event)- Called when events occurRL.log(logLevel, message)- Called for loggingRL.exit()- Called when the application is closingRL.config()-⚠️ Deprecated in this version
All functionality can be found in "API.md".
This version includes customizable splash screens that display at startup:
Screen 1: Custom text - Bold text on Raylib red background (customizable) Screen 2: "Made using" - Displays Raylib and ReiLua logos side-by-side
Each screen fades in (0.8s), displays (2.5s), and fades out (0.8s) for a total of ~8 seconds.
Skip During Development:
ReiLua.exe --no-logoCustomize:
- Change text in
src/splash.c - Replace logos in
logo/folder - Adjust timing with constants in
src/splash.c
See SPLASH_SCREENS.md for full documentation.
Beautiful loading screen with progress tracking:
functionRL.init() -- List your assetslocalassets={"assets/player.png", "assets/enemy.png", "assets/background.png", "assets/music.wav", } -- Start loading with progressRL.BeginAssetLoading(#assets) -- Load each assetfori, pathinipairs(assets) doRL.UpdateAssetLoading(path) -- Your loading codeifpath:match("%.png$") thentextures[i] =RL.LoadTexture(path) elseifpath:match("%.wav$") thensounds[i] =RL.LoadSound(path) endend-- Finish loadingRL.EndAssetLoading() endFeatures:
- Retro 1-bit pixel art aesthetic
- Animated loading text with dots
- Progress bar with dithering pattern
- Shows current asset name
- Progress counter (e.g., "3/10")
- Corner decorations
See ASSET_LOADING.md for full documentation.
Bundle all your Lua code into the executable for easy distribution:
# Copy Lua files to build directorycd build copy ..\your_game\*.lua .# Build with embedding cmake .. -DEMBED_MAIN=ON cmake --build . --config ReleaseResult: Single executable with all Lua code embedded!
Package images, sounds, fonts, and other assets into your executable:
# Create assets folder and copy filescd build mkdir assets copy ..\your_game\assets\* assets\ # Build with embedding cmake .. -DEMBED_ASSETS=ON cmake --build . --config ReleaseYour Lua code doesn't change! Use the same paths:
-- Works in both development and releaseplayerImg=RL.LoadTexture("assets/player.png") music=RL.LoadSound("assets/music.wav")See EMBEDDING.md for full documentation.
By default, ReiLua runs without a console window for a clean user experience. Enable it for debugging:
# Show console for debugging ReiLua.exe --log # Combine with other options ReiLua.exe --log --no-logo ReiLua.exe --log path/to/gameThis shows:
- TraceLog output
- Print statements
- Lua errors
- Debug information
One-command builds for development and release:
Development Build (Fast Iteration):
# Windows scripts\build_dev.bat # Linux/Unix chmod +x scripts/build_dev.sh scripts/build_dev.sh- No embedding
- Fast build times
- Edit code without rebuilding
Release Build (Distribution):
# Prepare files firstcd build copy ..\your_game\*.lua . mkdir assets copy ..\your_game\assets\* assets\ # Build releasecd .. # Windows scripts\build_release.bat # Linux/Unix scripts/build_release.sh- Embeds all Lua files
- Embeds all assets
- Creates single executable
- Release optimizations
See BUILD_SCRIPTS.md for full documentation.
ReiLua [Options] [Directory to main.lua or main] Options: -h, --help Show help message -v, --version Show ReiLua version -i, --interpret Interpret mode [File name] --log Show console window for logging (Windows only) --no-logo Skip splash screens (development) # Run game in current directory ReiLua.exe # Run game in specific folder ReiLua.exe path/to/game/ # Development mode (no splash, with console) ReiLua.exe --log --no-logo # Interpreter mode (run single script) ReiLua.exe -i script.lua # Show help ReiLua.exe --help # Show version ReiLua.exe --versionSome objects allocate memory that needs to be freed when no longer needed. By default, objects like Textures are unloaded by the Lua garbage collector. However, it's generally recommended to handle this manually in more complex projects:
RL.SetGCUnload()ReiLua can run single Lua files using interpreter mode:
ReiLua -i hello.luaThe given file will be called with dofile.
Generate API.md and ReiLua_API.lua from the build folder:
ReiLua -i ../tools/docgen.luaTip: Use tools/ReiLua_API.lua in your project folder to provide annotations when using "Lua Language Server".
You'll need to statically link Raylib and Lua to create the executable. This simplifies distribution, especially on Linux where different distros use different library versions.
- Raylib: https://github.com/raysan5/raylib
- Lua: https://github.com/lua/lua or https://github.com/LuaJIT/LuaJIT
- CMake: https://cmake.org/download/
- Build tools: MinGW (Windows), GCC/Make (Linux)
Note: Lua header files are from Lua 5.4.0. If using a different version, replace them.
- Download w64devkit from https://github.com/skeeto/w64devkit
- Download CMake from https://cmake.org/download/ (install with PATH environment variables set)
# Download Raylib source# Run w64devkit.exe and navigate to raylib/srccd raylib/src mingw32-make # Copy libraylib.a to ReiLua/lib folder copy libraylib.a path\to\ReiLua\lib\Download Lua source from https://github.com/lua/lua
Modify Lua's makefile:
# Change this:MYCFLAGS= $(LOCAL) -std=c99 -DLUA_USE_LINUX -DLUA_USE_READLINE # To this:MYCFLAGS= $(LOCAL) -std=c99 # Comment out or remove:MYLIBS= -ldl -lreadlineBuild:
# In w64devkit, navigate to Lua folder mingw32-make # Copy liblua.a to ReiLua/lib folder copy liblua.a path\to\ReiLua\lib\Quick Method (Recommended):
cd ReiLua scripts\build_dev.batManual Method:
cd ReiLua\build cmake -G "MinGW Makefiles" .. mingw32-makecd build ReiLua.exe ..\examples\snake\If you see a low-res snake racing off the window, success! Press Enter to reset.
sudo apt install build-essential cmakeCompile Raylib and Lua by following their instructions. They will compile to libraylib.a and liblua.a by default.
Move both .a files to the ReiLua/lib folder.
Quick Method (Recommended):
cd ReiLua chmod +x scripts/build_dev.sh scripts/build_dev.shManual Method:
cd ReiLua/build cmake .. make./ReiLua ../examples/snake/Not tested, but should work similarly to Linux.
Works best when Raylib is compiled using PLATFORM=DRM. See Raylib build instructions for Raspberry Pi.
Compile ReiLua with:
cmake .. -DDRM=ONNote: DRM should be launched from CLI, not in X.
Compile Raylib for web following its instructions: https://github.com/raysan5/raylib/wiki/Working-for-Web-(HTML5)
Modify Lua's makefile:
# Change:MYCFLAGS= $(LOCAL) -std=c99 -DLUA_USE_LINUX -DLUA_USE_READLINE # To:MYCFLAGS= $(LOCAL) -std=c99 # Change:MYLIBS= -ldl -lreadline # To:MYLIBS= -ldl # Change:CC= gcc # To:CC= emcc # Change:CFLAGS= -Wall -O2 $(MYCFLAGS) -fno-stack-protector -fno-common -march=native # To:CFLAGS= -Wall -O2 $(MYCFLAGS) -fno-stack-protector -fno-common # Change:AR= ar rc # To:AR= emar # Change: $(AR) $@ $? # To: $(AR) rcs $@ $?Build with make if emsdk environmental variables are correct.
Put libraylib.a and liblua.a into ReiLua/lib/web/.
cd ReiLua/build mkdir resources # Copy main.lua to resources/# Copy assets to resources/Structure:
ReiLua/ └── build/ └── resources/ ├── main.lua └── assets/ cd build cmake .. -DCMAKE_TOOLCHAIN_FILE=<YOUR_PATH>/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DPLATFORM=Web makepython -m http.server 8080Access in browser: localhost:8080/ReiLua.html
MyGame/ ├── main.lua ├── player.lua ├── enemy.lua ├── assets/ │ ├── player.png │ ├── enemy.png │ └── music.wav cd ReiLua/build # Copy all Lua files copy ..\MyGame\*.lua .# Copy assets mkdir assets copy ..\MyGame\assets\* assets\ # Or: xcopy /E /I ..\MyGame\assets assetscd .. scripts\build_release.bat # Or: scripts/build_release.sh on Linuxcd build ReiLua.exe --logVerify:
- No file loading errors
- Game runs correctly
- All assets load properly
mkdir Distribution copy ReiLua.exe Distribution\YourGameName.exeYour game is now a single executable ready for distribution!
Edit CMakeLists.txt:
project( YourGameName ) # Change from "ReiLua"Replace icon.ico with your own icon file, then rebuild.
Edit resources.rc:
VALUE "CompanyName", "Your Studio Name" VALUE "FileDescription", "Your Game Description" VALUE "ProductName", "Your Game Name" VALUE "LegalCopyright", "Copyright (C) Your Name, 2025" Edit src/splash.c:
constchar*text="YOUR STUDIO NAME"; // Change thisReplace logos:
# Replace these files before building logo/raylib_logo.png logo/reilua_logo.pngZed is a modern, high-performance code editor. Here's how to set it up for ReiLua development:
Download from: https://zed.dev/
- Open Zed
- Press
Cmd+Shift+P(Mac) orCtrl+Shift+P(Windows/Linux) - Type "install language server" and select Lua
- Zed will automatically install the Lua Language Server
Create .zed/settings.json in your project root:
{"lsp":{"lua-language-server":{"settings":{"Lua":{"runtime":{"version": "Lua 5.4" }, "diagnostics":{"globals": ["RL"] }, "workspace":{"library": ["ReiLua_API.lua"] } } } } }, "languages":{"Lua":{"format_on_save": "on", "formatter": "language_server" } } }Copy tools/ReiLua_API.lua to your project folder. This provides autocomplete and documentation for all ReiLua functions.
copy path\to\ReiLua\tools\ReiLua_API.lua your_game\Useful Zed shortcuts for Lua development:
Ctrl+P/Cmd+P- Quick file searchCtrl+Shift+F/Cmd+Shift+F- Search in filesCtrl+./Cmd+.- Code actionsF12- Go to definitionShift+F12- Find referencesCtrl+Space- Trigger autocomplete
Install useful extensions:
- Press
Ctrl+Shift+X/Cmd+Shift+X - Search and install:
- Lua - Syntax highlighting and language support
- Better Comments - Enhanced comment highlighting
- Error Lens - Inline error display
Create a workspace for ReiLua projects:
- Open your game folder in Zed
- File → Add Folder to Workspace
- Add the ReiLua source folder (for reference)
- File → Save Workspace As...
This lets you easily reference ReiLua source while developing your game.
For debugging Lua code with Zed:
- Use
print()statements liberally - Run ReiLua with
--logflag to see output - Use
RL.TraceLog()for more detailed logging:
RL.TraceLog(RL.LOG_INFO, "Player position: " ..x..", " ..y) RL.TraceLog(RL.LOG_WARNING, "Low health!") RL.TraceLog(RL.LOG_ERROR, "Failed to load asset!")Run ReiLua directly from Zed's terminal:
- Press
Ctrl+`/Cmd+`to open terminal - Run your game:
path\to\ReiLua.exe --log --no-logo- Use Multiple Cursors:
Alt+Clickto add cursors, great for batch edits - Split Views:
Ctrl+\to split editor for side-by-side editing - Symbol Search:
Ctrl+T/Cmd+Tto search for functions - Zen Mode:
Ctrl+K Zfor distraction-free coding - Live Grep:
Ctrl+Shift+Fto search across all files
- EMBEDDING.md - Complete guide to embedding Lua and assets
- ASSET_LOADING.md - Asset loading API and loading screen documentation
- SPLASH_SCREENS.md - Splash screen customization guide
- BUILD_SCRIPTS.md - Build scripts documentation
- API.md - Complete API reference (1000+ functions)
- UPGRADE_SUMMARY.md - Technical details of enhancements
- docs/API.md - All ReiLua/Raylib functions
- tools/ReiLua_API.lua - Lua annotations for IDE autocomplete
- examples/ - Example games and demos
Game doesn't start:
- Run with
--logto see error messages - Check that
main.luaexists - Verify all required assets exist
Assets not loading:
- Check file paths (use forward slashes or escaped backslashes)
- Verify files exist in the correct location
- Use
--logto see loading errors
Splash screens don't show:
- Check you're not using
--no-logoflag - Verify build completed successfully
- Rebuild project:
cmake --build . --config Release
Lua files not embedded:
- Ensure Lua files are in
build/directory before building - Check
main.luaexists - Verify
-DEMBED_MAIN=ONwas used
Assets not embedded:
- Create
build/assets/folder - Copy assets before building
- Verify
-DEMBED_ASSETS=ONwas used
Build fails:
- Check CMake and compiler are installed and in PATH
- Verify
libraylib.aandliblua.aare inlib/folder - Try clean build:
scripts\build_dev.bat clean
- Check documentation files listed above
- Review the examples in
examples/folder - Use
--logflag to see detailed error messages - Check your file paths and directory structure
Contributions are welcome! This is an enhanced version with additional features. When contributing:
- Test thoroughly with both development and release builds
- Update documentation if adding features
- Follow existing code style
- Test on multiple platforms if possible
ReiLua is licensed under the zlib/libpng license. See LICENSE file for details.
- Raylib - zlib/libpng license
- Lua - MIT license
- Oleaguid Font - Check font documentation for licensing
- Original ReiLua: https://github.com/Gamerfiend/ReiLua
- Raylib: https://github.com/raysan5/raylib
- Lua: https://www.lua.org/
- ReiLua Version: Based on original ReiLua with enhancements
- Raylib Version: 5.5
- Lua Version: 5.4
Happy Game Development!
