From 3090134068e99e73ca57e8c0b62534c9bc99e93b Mon Sep 17 00:00:00 2001 From: Indrajith K L Date: Fri, 7 Nov 2025 04:55:35 +0530 Subject: Changes Docs Folders --- html_docs/manual.html | 2144 ------------------------------------------------- 1 file changed, 2144 deletions(-) delete mode 100644 html_docs/manual.html (limited to 'html_docs/manual.html') diff --git a/html_docs/manual.html b/html_docs/manual.html deleted file mode 100644 index 5cae8e5..0000000 --- a/html_docs/manual.html +++ /dev/null @@ -1,2144 +0,0 @@ -Manual - -

ReiLua Manual

-

ReiLua - Enhanced Edition

-

> A modified version of ReiLua with embedded main.lua, embedded assets, splash screens, and asset loading system

-

About This Version

-

This is an enhanced version of ReiLua featuring:

- -

What is ReiLua?

-

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. -

Attributions

-

This enhanced version is built upon:

-

Core Framework

- -

Enhancements Added

- -

Additional Components

- -

Font

- -

Status

-

ReiLua is WIP and some planned raylib functionality is still missing, but it already has over 1000 functions. Current Raylib version is 5.5.

-

Included Submodules

- -

Missing Features

-

List of some MISSING features that are planned to be included:

- -

Roadmap

- -

Quick Start

-

For Game Developers

-

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 folder
-cd GameFolder
-path/to/ReiLua.exe
-
-# Skip splash screens during development
-ReiLua.exe --no-logo
-
-# Enable console for debugging
-ReiLua.exe --log --no-logo
-
-

Release Mode (Single Executable):

-
# See "Building for Release" section below
-
-

Basic Example

-

Create a main.lua file:

-
local textColor = RL.BLACK
-local textPos = { 192, 200 }
-local textSize = 20
-local text = "Congrats! You created your first window!"
-
-function RL.init()
-	RL.SetWindowTitle( "First window" )
-	RL.SetWindowState( RL.FLAG_VSYNC_HINT )
-end
-
-function RL.update( delta )
-	if RL.IsKeyPressed( RL.KEY_ENTER ) then
-		local winSize = RL.GetScreenSize()
-		local measuredSize = RL.MeasureTextEx( RL.GetFontDefault(), text, textSize, 2 )
-
-		textColor = RL.BLUE
-		textPos = { winSize[1] / 2 - measuredSize[1] / 2, winSize[2] / 2 - measuredSize[2] / 2 }
-	end
-
-	if RL.IsKeyPressed( RL.KEY_SPACE ) then
-		textColor = RL.RED
-		textPos = { 192, 200 }
-	end
-end
-
-function RL.draw()
-	RL.ClearBackground( RL.RAYWHITE )
-	RL.DrawText( text, textPos, textSize, textColor )
-end
-
-

Run it:

-
ReiLua.exe --no-logo
-
-

Framework Functions

-

ReiLua looks for a 'main.lua' or 'main' file as the entry point. There are seven Lua functions that the framework will call:

- -

All functionality can be found in "API.md".

-

Enhanced Features

-

1. Splash Screens

-

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-logo
-
-

Customize:

- -

See SPLASH_SCREENS.md for full documentation.

-

2. Asset Loading System

-

Beautiful loading screen with progress tracking:

-
function RL.init()
-    -- List your assets
-    local assets = {
-        "assets/player.png",
-        "assets/enemy.png",
-        "assets/background.png",
-        "assets/music.wav",
-    }
-
-    -- Start loading with progress
-    RL.BeginAssetLoading(#assets)
-
-    -- Load each asset
-    for i, path in ipairs(assets) do
-        RL.UpdateAssetLoading(path)
-
-        -- Your loading code
-        if path:match("%.png$") then
-            textures[i] = RL.LoadTexture(path)
-        elseif path:match("%.wav$") then
-            sounds[i] = RL.LoadSound(path)
-        end
-    end
-
-    -- Finish loading
-    RL.EndAssetLoading()
-end
-
-

Features:

- -

See ASSET_LOADING.md for full documentation.

-

3. Embedded Lua Files

-

Bundle all your Lua code into the executable for easy distribution:

-
# Copy Lua files to build directory
-cd build
-copy ..\your_game\*.lua .
-
-# Build with embedding
-cmake .. -DEMBED_MAIN=ON
-cmake --build . --config Release
-
-

Result: Single executable with all Lua code embedded!

-

4. Embedded Assets

-

Package images, sounds, fonts, and other assets into your executable:

-
# Create assets folder and copy files
-cd build
-mkdir assets
-copy ..\your_game\assets\* assets\
-
-# Build with embedding
-cmake .. -DEMBED_ASSETS=ON
-cmake --build . --config Release
-
-Your Lua code doesn't change! Use the same paths: -
-- Works in both development and release
-playerImg = RL.LoadTexture("assets/player.png")
-music = RL.LoadSound("assets/music.wav")
-
-

See EMBEDDING.md for full documentation.

-

5. Console Control (Windows)

-

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/game
-
-

This shows:

- -

6. Automated Build Scripts

-

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
-
- -

Release Build (Distribution):

-
# Prepare files first
-cd build
-copy ..\your_game\*.lua .
-mkdir assets
-copy ..\your_game\assets\* assets\
-
-# Build release
-cd ..
-
-# Windows
-scripts\build_release.bat
-
-# Linux/Unix
-scripts/build_release.sh
-
- -

See BUILD_SCRIPTS.md for full documentation.

-

Command Line Options

-
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)
-
-

Examples

-
# 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 --version
-
-

Object Unloading

-

Some 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()
-
-

Interpreter Mode

-

ReiLua can run single Lua files using interpreter mode:

-
ReiLua -i hello.lua
-
-

The given file will be called with dofile.

-

Generate API Documentation

-

Generate API.md and ReiLua_API.lua from the build folder:

-
ReiLua -i ../tools/docgen.lua
-
-Tip: Use tools/ReiLua_API.lua in your project folder to provide annotations when using "Lua Language Server". -

Building from Source

-

Prerequisites

-

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.

- -Note: Lua header files are from Lua 5.4.0. If using a different version, replace them. -

Windows

-

1. Install Tools

- -

2. Build Raylib

-
# Download Raylib source
-# Run w64devkit.exe and navigate to raylib/src
-cd raylib/src
-mingw32-make
-
-# Copy libraylib.a to ReiLua/lib folder
-copy libraylib.a path\to\ReiLua\lib\
-
-

3. Build Lua

-

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 -lreadline
-
-

Build:

-
# In w64devkit, navigate to Lua folder
-mingw32-make
-
-# Copy liblua.a to ReiLua/lib folder
-copy liblua.a path\to\ReiLua\lib\
-
-

4. Build ReiLua

-

Quick Method (Recommended):

-
cd ReiLua
-scripts\build_dev.bat
-
-

Manual Method:

-
cd ReiLua\build
-cmake -G "MinGW Makefiles" ..
-mingw32-make
-
-

5. Test

-
cd build
-ReiLua.exe ..\examples\snake\
-
-

If you see a low-res snake racing off the window, success! Press Enter to reset.

-

Linux

-

1. Install Dependencies

-
sudo apt install build-essential cmake
-
-

2. Build Raylib and Lua

-

Compile 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.

-

3. Build ReiLua

-

Quick Method (Recommended):

-
cd ReiLua
-chmod +x scripts/build_dev.sh
-scripts/build_dev.sh
-
-

Manual Method:

-
cd ReiLua/build
-cmake ..
-make
-
-

4. Test

-
./ReiLua ../examples/snake/
-
-

MacOS

-

Not tested, but should work similarly to Linux.

-

Raspberry Pi

-

Works best when Raylib is compiled using PLATFORM=DRM. See Raylib build instructions for Raspberry Pi.

-

Compile ReiLua with:

-
cmake .. -DDRM=ON
-
-Note: DRM should be launched from CLI, not in X. -

Web (Emscripten)

-

Compile Raylib for web following its instructions: https://github.com/raysan5/raylib/wiki/Working-for-Web-(HTML5)

-

1. Compile Lua for Web

-

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.

-

2. Prepare Libraries

-

Put libraylib.a and liblua.a into ReiLua/lib/web/.

-

3. Create Resources Folder

-
cd ReiLua/build
-mkdir resources
-# Copy main.lua to resources/
-# Copy assets to resources/
-
-

Structure:

-
ReiLua/
-└── build/
-    └── resources/
-        ├── main.lua
-        └── assets/
-
-

4. Build

-
cd build
-cmake .. -DCMAKE_TOOLCHAIN_FILE=/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DPLATFORM=Web
-make
-
-

5. Test

-
python -m http.server 8080
-
-

Access in browser: localhost:8080/ReiLua.html

-

Complete Release Workflow

-

Step 1: Prepare Your Game

-
MyGame/
-├── main.lua
-├── player.lua
-├── enemy.lua
-├── assets/
-│   ├── player.png
-│   ├── enemy.png
-│   └── music.wav
-
-

Step 2: Copy Files to Build Directory

-
cd ReiLua/build
-
-# Copy all Lua files
-copy ..\MyGame\*.lua .
-
-# Copy assets
-mkdir assets
-copy ..\MyGame\assets\* assets\
-# Or: xcopy /E /I ..\MyGame\assets assets
-
-

Step 3: Build Release

-
cd ..
-scripts\build_release.bat
-# Or: scripts/build_release.sh on Linux
-
-

Step 4: Test

-
cd build
-ReiLua.exe --log
-
-

Verify:

- -

Step 5: Distribute

-
mkdir Distribution
-copy ReiLua.exe Distribution\YourGameName.exe
-
-

Your game is now a single executable ready for distribution!

-

Customizing Your Executable

-

Change Executable Name

-

Edit CMakeLists.txt:

-
project( YourGameName )  # Change from "ReiLua"
-
-

Add Custom Icon

-

Replace icon.ico with your own icon file, then rebuild.

-

Edit Executable Properties

-

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"
-
-

Customize Splash Screens

-

Edit src/splash.c:

-
const char* text = "YOUR STUDIO NAME";  // Change this
-
-

Replace logos:

-
# Replace these files before building
-logo/raylib_logo.png
-logo/reilua_logo.png
-
-

Setting Up Zed Editor

-

Zed is a modern, high-performance code editor. Here's how to set it up for ReiLua development:

-

Install Zed

-

Download from: https://zed.dev/

-

Setup Lua Language Support

-

1. Open Zed 2. Press Cmd+Shift+P (Mac) or Ctrl+Shift+P (Windows/Linux) 3. Type "install language server" and select Lua 4. Zed will automatically install the Lua Language Server

-

Configure for ReiLua

-

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 ReiLua API Definitions

-

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\
-
-

Keyboard Shortcuts

-

Useful Zed shortcuts for Lua development:

- -

Extensions

-

Install useful extensions: 1. Press Ctrl+Shift+X / Cmd+Shift+X 2. Search and install:

- -

Workspace Setup

-

Create a workspace for ReiLua projects:

-

1. Open your game folder in Zed 2. File → Add Folder to Workspace 3. Add the ReiLua source folder (for reference) 4. File → Save Workspace As...

-

This lets you easily reference ReiLua source while developing your game.

-

Debugging

-

For debugging Lua code with Zed:

-

1. Use print() statements liberally 2. Run ReiLua with --log flag to see output 3. 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!")
-
-

Terminal Integration

-

Run ReiLua directly from Zed's terminal:

-

1. Press ` Ctrl+ ` / Cmd+ ` to open terminal 2. Run your game:

-
path\to\ReiLua.exe --log --no-logo
-
-

Tips for ReiLua Development in Zed

-

1. Use Multiple Cursors: Alt+Click to add cursors, great for batch edits 2. Split Views: Ctrl+\ to split editor for side-by-side editing 3. Symbol Search: Ctrl+T / Cmd+T to search for functions 4. Zen Mode: Ctrl+K Z for distraction-free coding 5. Live Grep: Ctrl+Shift+F to search across all files

-

Documentation

-

Comprehensive Guides

- -

Quick References

- -

Troubleshooting

-

Common Issues

-

Game doesn't start:

-
-

Assets not loading:

-
-

Splash screens don't show:

-
-

Lua files not embedded:

-
-

Assets not embedded:

-
-

Build fails:

-
-

Getting Help

-

1. Check documentation files listed above 2. Review the examples in examples/ folder 3. Use --log` flag to see detailed error messages 4. Check your file paths and directory structure

-

Contributing

-

Contributions are welcome! This is an enhanced version with additional features. When contributing:

-

1. Test thoroughly with both development and release builds 2. Update documentation if adding features 3. Follow existing code style 4. Test on multiple platforms if possible

-

License

-

ReiLua is licensed under the zlib/libpng license. See LICENSE file for details.

-

Third-Party Licenses

- -

Contact & Links

- -

Version Information

- -

---

-

Happy Game Development!

-
-

Embedding

-

Embedding main.lua into Executable

-

When you're ready to ship your game, you can embed all Lua files and asset files directly into the executable.

-

Development vs Release Workflow

-

Development Build (Fast Iteration)

-

During development, use external files for quick iteration.

-

Setup:

-
GameFolder/
-├── ReiLua.exe
-├── main.lua
-├── player.lua
-└── assets/
-    ├── player.png
-    └── music.wav
-
-

Build:

-
cd build
-cmake ..
-cmake --build .
-
-

Benefits:

- -

Release Build (Single Executable)

-

For distribution, embed everything into one file.

-

Setup:

-
cd build
-
-# Copy Lua files to build directory
-copy ..\main.lua .
-copy ..\player.lua .
-
-# Create assets folder and copy files
-mkdir assets
-copy ..\player.png assets\
-copy ..\music.wav assets\
-
-

Build:

-
# Configure with embedding
-cmake .. -DEMBED_MAIN=ON -DEMBED_ASSETS=ON
-
-# Build release
-cmake --build . --config Release
-
-

Result:

-
Distribution/
-└── YourGame.exe  (Everything embedded!)
-
-

Benefits:

- -

Quick Start

-

Embedding Lua Files

-

1. Copy your Lua files to the build directory:

-
   copy main.lua build\main.lua
-   copy player.lua build\player.lua
-   
-

2. Build with EMBED_MAIN option:

-
   cd build
-   cmake .. -DEMBED_MAIN=ON
-   cmake --build . --config Release
-   
-

Command Line Options

-

ReiLua supports several command-line options:

-
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)
-
-

Console/Logging

-

By default, ReiLua runs without a console window for a clean user experience. To enable console output for debugging:

-
# Run with console for debugging
-ReiLua.exe --log
-
-# You can also combine with other options
-ReiLua.exe --log path/to/game
-
-# Or with interpret mode
-ReiLua.exe --log -i script.lua
-
-

This is useful during development to see:

- -

Complete Release Workflow

-

Here's a complete step-by-step guide to prepare your game for release:

-

Step 1: Organize Your Project

-

Ensure your project has this structure:

-
MyGame/
-├── main.lua
-├── player.lua
-├── enemy.lua
-├── player.png
-├── enemy.png
-├── music.wav
-└── icon.ico (optional)
-
-

Step 2: Customize Branding (Optional)

-

Change executable icon:

-
# Replace ReiLua's icon with yours
-copy MyGame\icon.ico ReiLua\icon.ico
-
-

Edit executable properties: Open ReiLua\resources.rc and modify:

-
VALUE "CompanyName", "Your Studio Name"
-VALUE "FileDescription", "Your Game Description"
-VALUE "ProductName", "Your Game Name"
-VALUE "LegalCopyright", "Copyright (C) Your Name, 2025"
-
-

Change executable name: Edit ReiLua\CMakeLists.txt:

-
project( YourGameName )  # Change from "ReiLua"
-
-

See CUSTOMIZATION.md for full details.

-

Important: Asset Paths

-Keep your paths consistent! The embedding system now preserves the assets/ prefix, so use the same paths in both development and release: -
--  Correct - works in both dev and release
-playerImage = RL.LoadTexture("assets/player.png")
-backgroundImg = RL.LoadTexture("assets/background.png")
-musicSound = RL.LoadSound("assets/music.wav")
-
-

Your Lua code doesn't need to change between development and release builds!

-

Step 3: Prepare Build Directory

-
cd ReiLua\build
-
-# Copy all Lua files
-copy ..\MyGame\*.lua .
-
-# Create assets folder
-mkdir assets
-
-# Copy all asset files (images, sounds, etc.)
-copy ..\MyGame\*.png assets\
-copy ..\MyGame\*.wav assets\
-copy ..\MyGame\*.ogg assets\
-# Or copy entire folders
-xcopy /E /I ..\MyGame\images assets\images
-xcopy /E /I ..\MyGame\sounds assets\sounds
-
-

Step 4: Build Release

-
# Configure with embedding enabled
-cmake .. -DEMBED_MAIN=ON -DEMBED_ASSETS=ON
-
-# Build in release mode
-cmake --build . --config Release
-
-

Step 5: Test Release Build

-
# Test with console to verify everything loaded
-YourGameName.exe --log
-
-# Test production mode (no console)
-YourGameName.exe
-
-

Check console output for:

- -

Step 6: Package for Distribution

-
# Create distribution folder
-mkdir ..\Distribution
-copy YourGameName.exe ..\Distribution\
-
-# Optional: Add README, LICENSE, etc.
-copy ..\README.txt ..\Distribution\
-
-

Your game is now ready to distribute as a single executable!

-

Workflow Summary

-

| Stage | Build Command | Files Needed | Result | |-------|--------------|--------------|--------| | Development | cmake .. && cmake --build . | Lua + assets external | Fast iteration | | Testing | cmake .. -DEMBED_MAIN=ON && cmake --build . | Lua in build/ | Test embedding | | Release | cmake .. -DEMBED_MAIN=ON -DEMBED_ASSETS=ON && cmake --build . --config Release | Lua + assets in build/ | Single .exe |

-

Troubleshooting

-

Problem: "No .lua files found in build directory"

-
# Solution: Copy Lua files to build directory
-copy ..\*.lua .
-
-

Problem: "No files found in assets folder"

-
# Solution: Create assets folder and copy files
-mkdir assets
-copy ..\*.png assets\
-
-

Problem: Game crashes on startup

-
# Solution: Run with --log to see error messages
-YourGameName.exe --log
-
-

Problem: Assets not loading

- -

Notes

- -

Customizing Your Executable

-

Want to add your own icon and version info to the executable? See CUSTOMIZATION.md for details on:

- -
-

Asset Loading

-

Asset Loading System

-

ReiLua includes a built-in asset loading system with a loading screen UI that shows progress while assets are being loaded.

-

Features

- -

API Functions

-

RL.BeginAssetLoading(totalAssets)

-

Initialize asset loading progress tracking and show the loading screen.

-

Parameters:

- -

Example:

-
RL.BeginAssetLoading(10)  -- We're loading 10 assets
-
-

---

-

RL.UpdateAssetLoading(assetName)

-

Update the loading progress and display current asset being loaded.

-

Parameters:

- -

Example:

-
RL.UpdateAssetLoading("player.png")
-
-

Call this after each asset is loaded to update the progress bar.

-

---

-

RL.EndAssetLoading()

-

Finish asset loading and hide the loading screen.

-

Example:

-
RL.EndAssetLoading()
-
-

Quick Example

-
function RL.init()
-    -- List of assets to load
-    local assetsToLoad = {
-        "assets/player.png",
-        "assets/enemy.png", 
-        "assets/background.png",
-        "assets/music.wav",
-    }
-    
-    -- Begin loading
-    RL.BeginAssetLoading(#assetsToLoad)
-    
-    -- Load each asset
-    for i, path in ipairs(assetsToLoad) do
-        RL.UpdateAssetLoading(path)  -- Update progress
-        
-        -- Load the actual asset
-        if path:match("%.png$") or path:match("%.jpg$") then
-            textures[i] = RL.LoadTexture(path)
-        elseif path:match("%.wav$") or path:match("%.ogg$") then
-            sounds[i] = RL.LoadSound(path)
-        end
-    end
-    
-    -- Done!
-    RL.EndAssetLoading()
-end
-
-

Complete Example

-
local assets = {}
-
-local assetsToLoad = {
-    {type="texture", name="player", path="assets/player.png"},
-    {type="texture", name="enemy", path="assets/enemy.png"},
-    {type="texture", name="background", path="assets/background.png"},
-    {type="sound", name="music", path="assets/music.wav"},
-    {type="sound", name="shoot", path="assets/shoot.wav"},
-    {type="font", name="title", path="assets/title.ttf"},
-}
-
-function RL.init()
-    RL.SetWindowTitle("My Game")
-    
-    -- Start loading with progress
-    RL.BeginAssetLoading(#assetsToLoad)
-    
-    -- Load all assets
-    for i, asset in ipairs(assetsToLoad) do
-        -- Show current asset name on loading screen
-        RL.UpdateAssetLoading(asset.name)
-        
-        -- Load based on type
-        if asset.type == "texture" then
-            assets[asset.name] = RL.LoadTexture(asset.path)
-        elseif asset.type == "sound" then
-            assets[asset.name] = RL.LoadSound(asset.path)
-        elseif asset.type == "font" then
-            assets[asset.name] = RL.LoadFont(asset.path)
-        end
-    end
-    
-    -- Loading complete!
-    RL.EndAssetLoading()
-    
-    print("Game ready!")
-end
-
-function RL.update(delta)
-    -- Your game logic
-end
-
-function RL.draw()
-    RL.ClearBackground(RL.RAYWHITE)
-    
-    -- Use loaded assets
-    if assets.background then
-        RL.DrawTexture(assets.background, {0, 0}, RL.WHITE)
-    end
-    
-    if assets.player then
-        RL.DrawTexture(assets.player, {100, 100}, RL.WHITE)
-    end
-end
-
-

Loading Screen Appearance

-

The loading screen features a clean 1-bit pixel art style:

-

Design:

- -

Elements:

- -

Background:

- -

Color Palette:

- -

Style Inspiration:

- -

Customization

-

If you want to customize the loading screen appearance, you can modify the colors and sizes in src/lua_core.c in the drawLoadingScreen() function.

-

Performance Tips

-

1. Call UpdateAssetLoading AFTER loading - This ensures the progress updates at the right time 2. Load assets in order of importance - Load critical assets first 3. Group similar assets - Load all textures, then sounds, etc. 4. Use descriptive names - Shows better feedback to users

-

Example Asset Loading Patterns

-

Pattern 1: Simple List

-
local files = {"player.png", "enemy.png", "music.wav"}
-RL.BeginAssetLoading(#files)
-for i, file in ipairs(files) do
-    RL.UpdateAssetLoading(file)
-    -- load file
-end
-RL.EndAssetLoading()
-
-

Pattern 2: With Types

-
local assets = {
-    textures = {"player.png", "enemy.png"},
-    sounds = {"music.wav", "shoot.wav"},
-}
-local total = #assets.textures + #assets.sounds
-
-RL.BeginAssetLoading(total)
-for _, file in ipairs(assets.textures) do
-    RL.UpdateAssetLoading(file)
-    -- load texture
-end
-for _, file in ipairs(assets.sounds) do
-    RL.UpdateAssetLoading(file)
-    -- load sound
-end
-RL.EndAssetLoading()
-
-

Pattern 3: Error Handling

-
RL.BeginAssetLoading(#files)
-for i, file in ipairs(files) do
-    RL.UpdateAssetLoading(file)
-    
-    if RL.FileExists(file) then
-        -- load file
-    else
-        print("Warning: " .. file .. " not found")
-    end
-end
-RL.EndAssetLoading()
-
-

When to Use

-

Use the loading system when:

- -

You can skip it when:

- -

✨ Benefits

- -

The loading system makes your game feel polished with just a few lines of code!

-
-

Splash Screens

-

Splash Screens

-

ReiLua includes a built-in splash screen system that displays splash screens before your game loads. This gives your game a polished appearance right from startup.

-

Overview

-

When you run your ReiLua game, it automatically shows two splash screens in sequence:

-

1. Custom Text - Clean, bold text on Raylib red background (similar to Squid Game style) 2. "Made using" - Text with Raylib and ReiLua logos displayed side-by-side

-

Each splash screen:

- -

Features

-

Always Embedded

-

The logo images are always embedded into the executable in both development and release builds. This means:

- -

Asset Loading Integration

-

The splash screens display before your game's asset loading begins. This means:

-

1. User starts your game 2. Splash screens play (~8 seconds) 3. Your RL.init() function runs 4. Asset loading with progress indicator (if you use it) 5. Your game starts

-

This creates a smooth, polished startup experience.

-

Skipping Splash Screens (Development)

-

During development, you often need to test your game repeatedly. Waiting for splash screens every time can slow down your workflow. Use the --no-logo flag to skip them:

-
# Windows
-ReiLua.exe --no-logo
-
-# Linux/Mac
-./ReiLua --no-logo
-
-# With other options
-ReiLua.exe --log --no-logo
-./ReiLua --no-logo path/to/game/
-
-Note: The --no-logo flag only works in development. In release builds, users should see the full splash screen sequence. -

Technical Details

-

How It Works

-

The splash screen system is implemented in C and runs before any Lua code executes:

-

1. Logo Embedding: During build, scripts/embed_logo.py converts PNG files to C byte arrays 2. Initialization: Before calling RL.init(), the engine initializes splash screens 3. Display Loop: A dedicated loop handles timing, fading, and rendering 4. Cleanup: After completion, resources are freed and Lua code begins

-

Files

- -

Build Integration

-

The CMakeLists.txt automatically:

-

1. Runs scripts/embed_logo.py during build 2. Generates embedded_logo.h with logo data 3. Defines EMBED_LOGO flag 4. Compiles splash.c with the project

-

No manual steps required - it just works!

-

Customization

-

Changing Splash Screen Text

-

To change the default text to your studio name:

-

1. Open src/splash.c 2. Find the splash drawing function 3. Change the text line:

-
   const char* text = "YOUR STUDIO NAME";
-   
-

4. Rebuild the project

-Note: Use ALL CAPS for the Squid Game-style aesthetic. -

Changing Logos

-

To use different logos:

-

1. Replace logo/raylib_logo.png and/or logo/reilua_logo.png with your images 2. Recommended size: 256x256 or smaller (logos are auto-scaled to max 200px) 3. Format: PNG with transparency support 4. Rebuild the project - logos will be automatically embedded

-

Changing Timing

-

To adjust how long each screen displays:

-

1. Open src/splash.c 2. Modify these constants at the top:

-
   #define FADE_IN_TIME 0.8f    // Seconds to fade in
-   #define DISPLAY_TIME 2.5f    // Seconds to display fully
-   #define FADE_OUT_TIME 0.8f   // Seconds to fade out
-   
-

3. Rebuild the project

-

Removing Splash Screens Entirely

-

If you don't want any splash screens:

-

1. Open src/main.c 2. Find this block:

-
   /* Show splash screens if not skipped */
-   if ( !skip_splash ) {
-       splashInit();
-       // ... splash code ...
-       splashCleanup();
-   }
-   
-

3. Comment out or remove the entire block 4. Rebuild the project

-

Example: Complete Startup Sequence

-

Here's what a typical game startup looks like with everything enabled:

-
ReiLua.exe MyGame/
-
-

User Experience: 1. Splash Screen 1 (4.1 seconds)

- -

2. Splash Screen 2 (4.1 seconds)

- -

3. Asset Loading (varies)

- -

4. Game Start

- -

Best Practices

-

1. Keep --no-logo for Development: Always use --no-logo during active development 2. Test Without Flag: Occasionally test without --no-logo to ensure splash screens work 3. Customize for Your Studio: Change the text and logos to match your branding 4. Consider Total Time: Splash (~8s) + Loading (varies) = Total startup time 5. Optimize Loading: Keep asset loading fast to maintain a good first impression

-

Troubleshooting

-

Splash Screens Don't Show

-Problem: Game starts immediately without splash screens -Solutions: - -

Logos Appear Corrupted

-Problem: Logos display incorrectly or not at all -Solutions: - -

Compilation Errors

-Problem: Build fails with logo-related errors -Solutions: - -

Command Reference

-
# Development (skip splash)
-ReiLua --no-logo
-
-# Development with logging
-ReiLua --log --no-logo
-
-# Production/testing (full splash)
-ReiLua
-
-# Help
-ReiLua --help
-
-

---

-

The splash screen system adds a polished touch to your ReiLua games with minimal effort. Customize it to match your studio's branding and give players a great first impression!

-
-

Build Scripts

-

Build Scripts Documentation

-

ReiLua includes automated build scripts for easy development and release builds.

-

Available Scripts

-

Development Build Scripts

- -

Release Build Scripts

- -

Development Build

-

Purpose

-

Fast iteration during game development with external Lua files and assets.

-

Usage

-

Windows:

-
scripts\build_dev.bat
-
-

Linux/Unix:

-
chmod +x scripts/build_dev.sh
-scripts/build_dev.sh
-
-

Features

- -

Output

- -

Release Build

-

Purpose

-

Create a single-file executable for distribution with all code and assets embedded.

-

Preparation

-

Before running the release build, prepare your files:

-
cd build
-
-# Copy all Lua files
-copy ..\your_game\*.lua .
-# Or: cp ../your_game/*.lua .
-
-# Copy assets
-mkdir assets
-copy ..\your_game\assets\* assets\
-# Or: cp -r ../your_game/assets/* assets/
-
-

Usage

-

Windows:

-
scripts\build_release.bat
-
-

Linux/Unix:

-
chmod +x scripts/build_release.sh
-scripts/build_release.sh
-
-

Features

- -

Output

- -

Build Configuration

-

The release build automatically configures:

- -

Customizing Your Executable

-

Adding Custom Icon

-

1. Replace icon.ico with your own icon file 2. Keep the same filename or update resources.rc 3. Rebuild

-

Changing Executable Properties

-

Edit resources.rc to customize:

-
VALUE "CompanyName", "Your Studio Name"
-VALUE "FileDescription", "Your Game Description"
-VALUE "ProductName", "Your Game Name"
-VALUE "LegalCopyright", "Copyright (C) Your Name, 2025"
-
-

Renaming the Executable

-

Edit CMakeLists.txt:

-
project( YourGameName )  # Line 6
-
-

After building, the executable will be named YourGameName.exe.

-

Workflow Examples

-

Development Workflow

-
# Initial setup
-scripts\build_dev.bat
-
-# Edit your Lua files in your game directory
-# ... make changes ...
-
-# Just run - no rebuild needed!
-cd your_game
-path\to\build\ReiLua.exe
-
-# If you modify C code, rebuild
-scripts\build_dev.bat
-
-

Release Workflow

-
# 1. Prepare files
-cd build
-copy ..\your_game\*.lua .
-mkdir assets
-copy ..\your_game\assets\* assets\
-
-# 2. Build release
-cd ..
-scripts\build_release.bat
-
-# 3. Test
-cd build
-ReiLua.exe --log
-
-# 4. Distribute
-# Copy build\ReiLua.exe to your distribution folder
-
-

Troubleshooting

-

"CMake configuration failed"

- -

"No Lua files found"

- -

"Build failed"

- -

Development build embedding warning

- -

Script Features

-

Safety Features

- -

User Friendly

- -

Notes

- -
-

Customization

-

Customizing Your ReiLua Executable

-

This guide explains how to customize the ReiLua executable with your own branding.

-

Overview

-

You can customize:

- -

Quick Customization Checklist

- -

1. Changing the Executable Name

-

The easiest customization - change "ReiLua.exe" to "YourGame.exe".

-

Steps

-

1. Open CMakeLists.txt 2. Find line 6 (near the top):

-
   project( ReiLua )
-   
-

3. Change to your game name:

-
   project( MyAwesomeGame )
-   
-

4. Rebuild:

-
   cd build
-   cmake ..
-   cmake --build . --config Release
-   
-

Result: Executable is now named MyAwesomeGame.exe

-

2. Adding a Custom Icon

-

Replace the default icon with your game's icon.

-

Requirements

- -

Steps

-

1. Create or convert your image to .ico format 2. Replace icon.ico in the ReiLua root folder with your icon 3. Keep the same filename (icon.ico) or update resources.rc:

-
   IDI_ICON1 ICON "your_icon.ico"
-   
-

4. Rebuild the project

-Tip: Many online tools can convert PNG to ICO: - -

3. Customizing Executable Properties

-

When users right-click your .exe and select "Properties", they see file information. Customize this to show your game details.

-

Steps

-

1. Open resources.rc 2. Find the VERSIONINFO section 3. Modify these values:

-
1 VERSIONINFO
-FILEVERSION     1,0,0,0      // Change version numbers
-PRODUCTVERSION  1,0,0,0      // Change product version
-FILEFLAGSMASK   0x3fL
-FILEFLAGS       0x0L
-FILEOS          VOS_NT_WINDOWS32
-FILETYPE        VFT_APP
-FILESUBTYPE     VFT2_UNKNOWN
-BEGIN
-    BLOCK "StringFileInfo"
-    BEGIN
-        BLOCK "040904b0"
-        BEGIN
-            VALUE "CompanyName",      "Your Studio Name"           // Your company/studio
-            VALUE "FileDescription",  "Your Game - An awesome game"  // Game description
-            VALUE "FileVersion",      "1.0.0.0"                    // File version string
-            VALUE "InternalName",     "YourGame"                   // Internal name
-            VALUE "LegalCopyright",   "Copyright (C) 2025 Your Name"  // Copyright notice
-            VALUE "OriginalFilename", "YourGame.exe"               // Original filename
-            VALUE "ProductName",      "Your Game"                  // Product name
-            VALUE "ProductVersion",   "1.0.0.0"                    // Product version string
-        END
-    END
-    BLOCK "VarFileInfo"
-    BEGIN
-        VALUE "Translation", 0x409, 1200
-    END
-END
-
-

Common Values

-FileVersion / ProductVersion Format: Major, Minor, Patch, Build - -CompanyName Examples: - -FileDescription: - -LegalCopyright: - -

4. Rebuild the project

-

4. Customizing Splash Screens

-

Change the text and logos that appear when your game starts.

-

Changing Splash Screen Text

-

1. Open src/splash.c 2. Find the splash drawing function (around line 150) 3. Change this line:

-
   const char* text = "YOUR STUDIO NAME";
-   
-Style Tips: - -

Changing Splash Screen Logos

-

1. Create or find your logos:

- -

2. Replace these files:

-
   logo/raylib_logo.png  → Your game logo
-   logo/reilua_logo.png  → Your studio logo (or keep ReiLua logo as credit)
-   
-

3. Logo sizing:

- -

4. Rebuild the project - logos are automatically embedded

-

Changing Splash Screen Timing

-

1. Open src/splash.c 2. Modify these constants at the top:

-
   #define FADE_IN_TIME 0.8f    // Seconds to fade in (default: 0.8)
-   #define DISPLAY_TIME 2.5f    // Seconds fully visible (default: 2.5)
-   #define FADE_OUT_TIME 0.8f   // Seconds to fade out (default: 0.8)
-   
-Recommendations: - -

Changing Splash Screen Colors

-

1. Open src/splash.c 2. Find color definitions:

-
   // First splash screen background (Raylib red)
-   Color bgColor = (Color){ 230, 41, 55, 255 };  // Change these RGB values
-   
-   // Second splash screen background (Black)
-   Color bg = BLACK;  // Change to any color
-   
-Color Examples: - -

5. Customizing the Loading Screen

-

Change the appearance of the asset loading screen.

-

Steps

-

1. Open src/lua_core.c 2. Find the drawLoadingScreen() function 3. Modify colors and style:

-
// Background color
-Color bgColor = BLACK;  // Change background
-
-// Text color
-Color textColor = WHITE;  // Change text color
-
-// Progress bar fill color
-Color fillColor = WHITE;  // Change bar fill
-
-// Border color
-Color borderColor = WHITE;  // Change borders
-
-

Customizing Loading Text

-
// In drawLoadingScreen() function
-const char* loadingText = "LOADING";  // Change to "LOADING GAME", etc.
-
-

Changing Progress Bar Size

-
int barWidth = 200;   // Default 200px, change as needed
-int barHeight = 16;   // Default 16px, change as needed
-int borderThick = 2;  // Border thickness
-
-

6. Complete Rebranding Example

-

Here's a complete example of rebranding ReiLua as "Space Quest":

-

1. CMakeLists.txt

-
project( SpaceQuest )
-
-

2. resources.rc

-
VALUE "CompanyName",      "Cosmic Games Studio"
-VALUE "FileDescription",  "Space Quest - Explore the Galaxy"
-VALUE "FileVersion",      "1.0.0.0"
-VALUE "InternalName",     "SpaceQuest"
-VALUE "LegalCopyright",   "Copyright (C) 2025 Cosmic Games"
-VALUE "OriginalFilename", "SpaceQuest.exe"
-VALUE "ProductName",      "Space Quest"
-VALUE "ProductVersion",   "1.0.0.0"
-
-

3. icon.ico

-

Replace with your space-themed icon

-

4. src/splash.c

-
const char* text = "COSMIC GAMES STUDIO";
-
-

5. logo/ folder

-
logo/raylib_logo.png  → Your game logo (space ship, planet, etc.)
-logo/reilua_logo.png  → Studio logo (keep ReiLua logo for credit)
-
-

6. Build

-
cd build
-cmake ..
-cmake --build . --config Release
-
-

Result: SpaceQuest.exe with all your custom branding!

-

7. Advanced: Removing ReiLua Branding

-

If you want to completely remove ReiLua references:

-

Remove "Made with ReiLua" Logo

-

1. Open src/splash.c 2. Find drawMadeWithSplash() function 3. Comment out or modify the function to only show your logo

-

Remove Second Splash Screen

-

1. Open src/main.c 2. Find the splash screen loop 3. Modify to only call your custom splash

-Note: Please keep attribution to Raylib and ReiLua in your game's credits or about screen as a courtesy! -

8. Build and Test

-

After making any customizations:

-
# Clean build (recommended after customizations)
-cd build
-rm -rf *  # Or: rmdir /s /q * on Windows
-cmake ..
-cmake --build . --config Release
-
-# Test with console
-YourGame.exe --log
-
-# Test production mode
-YourGame.exe
-
-

Verify:

- -

Checklist: Release-Ready Customization

-

Before releasing your game:

- -

Tips for Polish

-

1. Consistent Branding: Use the same colors, fonts, and style across splash screens, loading screen, and in-game UI

-

2. Icon Quality: Invest time in a good icon - it's the first thing users see

-

3. Version Management: Update version numbers for each release

-

4. Legal Info: Always include proper copyright and attribution

-

5. Test Everything: Test your branded executable on a clean system

-

6. Keep Credits: Mention Raylib and ReiLua in your game's credits screen

-

Troubleshooting

-

Icon doesn't change:

- -

Properties don't update:

- -

Splash screens don't show changes:

- -

Executable name unchanged:

- -

Additional Resources

-

Icon Creation Tools

- -

Image Editing

- -

Color Picking

- -

---

-

Now your ReiLua executable is fully branded and ready to represent your game!

-
-

Editor Setup

-

Zed Editor Setup for ReiLua

-

This guide explains how to set up autocomplete, type hints, and documentation for ReiLua in Zed Editor.

-

---

-

Method 1: Using Lua Language Server (Recommended)

-

Zed uses the Lua Language Server (LuaLS) for Lua support. ReiLua includes tools/ReiLua_API.lua with LuaLS annotations.

-

Setup Steps

-

1. Install Lua Language Server in Zed

-

Zed should automatically install LuaLS when you open a Lua file. If not:

-

1. Open Zed 2. Go to Extensions (Cmd/Ctrl + Shift + X) 3. Search for "Lua" 4. Install the Lua extension

-

2. Configure Your Project

-

Create a .luarc.json file in your project root:

-
{
-  "runtime.version": "Lua 5.4",
-  "workspace.library": [
-    "${3rd}/luassert/library",
-    "${3rd}/busted/library"
-  ],
-  "completion.enable": true,
-  "diagnostics.globals": [
-    "RL"
-  ],
-  "workspace.checkThirdParty": false
-}
-
-

3. Copy tools/ReiLua_API.lua to Your Project

-

Copy tools/ReiLua_API.lua to your game project folder:

-
# From ReiLua directory
-cp tools/ReiLua_API.lua /path/to/your/game/project/
-
-

Or on Windows:

-
Copy-Item tools/ReiLua_API.lua "C:\path\to\your\game\project\"
-
-

4. (Optional) Create Library Directory

-

For better organization, create a library directory:

-
your-game/
-├── main.lua
-├── .luarc.json
-└── .lua/
-    └── tools/ReiLua_API.lua
-
-

Update .luarc.json:

-
{
-  "runtime.version": "Lua 5.4",
-  "workspace.library": [".lua"],
-  "completion.enable": true,
-  "diagnostics.globals": ["RL"],
-  "workspace.checkThirdParty": false
-}
-
-

---

-

Method 2: Global Configuration (All Projects)

-

To make ReiLua API available for all projects:

-

Windows

-

1. Create directory: %USERPROFILE%\.luarocks\lib\lua\5.4\ 2. Copy tools/ReiLua_API.lua to this directory 3. Add to global LuaLS config:

-Location: %APPDATA%\Zed\settings.json or via Zed settings -
{
-  "lsp": {
-    "lua-language-server": {
-      "settings": {
-        "Lua.workspace.library": [
-          "C:\\Users\\YourName\\.luarocks\\lib\\lua\\5.4"
-        ],
-        "Lua.diagnostics.globals": ["RL"]
-      }
-    }
-  }
-}
-
-

Linux/macOS

-

1. Create directory: ~/.lua/reilua/ 2. Copy tools/ReiLua_API.lua to this directory 3. Update Zed settings:

-
{
-  "lsp": {
-    "lua-language-server": {
-      "settings": {
-        "Lua.workspace.library": [
-          "~/.lua/reilua"
-        ],
-        "Lua.diagnostics.globals": ["RL"]
-      }
-    }
-  }
-}
-
-

---

-

Method 3: Using Zed's LSP Configuration

-

Create a .zed/settings.json in your project: > Note There is a sample zed settings json file in the repo root (zed.sample.settings.json)

-
{
-  "lsp": {
-    "lua-language-server": {
-      "settings": {
-        "Lua.runtime.version": "Lua 5.4",
-        "Lua.workspace.library": [
-          "."
-        ],
-        "Lua.completion.enable": true,
-        "Lua.completion.callSnippet": "Replace",
-        "Lua.completion.displayContext": 3,
-        "Lua.diagnostics.globals": [
-          "RL"
-        ],
-        "Lua.hint.enable": true,
-        "Lua.hint.paramName": "All",
-        "Lua.hint.setType": true
-      }
-    }
-  }
-}
-
-

---

-

Verifying Setup

-

Create a test file test.lua:

-
function RL.init()
-    -- Type "RL." and you should see autocomplete
-    RL.SetWindowTitle("Test")  -- Should show documentation
-
-    local color = RL.RED  -- Should autocomplete color constants
-
-    -- Hover over functions to see documentation
-    RL.DrawText("Hello", 10, 10, 20, color)
-end
-
-function RL.update(delta)
-    -- 'delta' should show as number type
-end
-
-

If autocomplete works, you should see:

- -

---

-

Enhanced Features

-

Enable Inlay Hints

-

In Zed settings:

-
{
-  "inlay_hints": {
-    "enabled": true
-  },
-  "lsp": {
-    "lua-language-server": {
-      "settings": {
-        "Lua.hint.enable": true,
-        "Lua.hint.paramName": "All",
-        "Lua.hint.setType": true,
-        "Lua.hint.paramType": true
-      }
-    }
-  }
-}
-
-

This will show:

- -

Disable Annoying Warnings

-

Add these to suppress common false positives:

-
{
-  "lsp": {
-    "lua-language-server": {
-      "settings": {
-        "Lua.diagnostics.disable": [
-          "lowercase-global",
-          "unused-local",
-          "duplicate-set-field",
-          "missing-fields",
-          "undefined-field"
-        ],
-        "Lua.diagnostics.globals": ["RL"]
-      }
-    }
-  }
-}
-
-

Common warnings and what they mean:

- -

> Note: The tools/ReiLua_API.lua file now uses type annotations instead of function definitions for callbacks to prevent duplicate warnings.

-

---

-

Troubleshooting

-

"duplicate-set-field" Error

-Problem: Getting warnings like Duplicate field 'init'. (Lua Diagnostics. duplicate-set-field) -Why: The tools/ReiLua_API.lua file previously defined callback functions as empty function definitions. When you define them in your main.lua, LSP sees it as redefining the same field. -Solution: The latest tools/ReiLua_API.lua now uses type annotations instead: -
-- Old way (caused warnings)
-function RL.init() end
-
--- New way (no warnings)
----@type fun()
-RL.init = nil
-
-

Fix Steps: 1. Update tools/ReiLua_API.lua - Copy the latest version from the repository 2. Or add to diagnostics.disable in your configuration:

-
   {
-     "diagnostics.disable": ["duplicate-set-field"]
-   }
-   
-

3. Restart Zed to reload the configuration

-

Benefits of the new approach:

- -

---

-

Autocomplete Not Working

-

1. Restart Zed after configuration changes 2. Check LSP Status: Look for Lua Language Server in bottom-right status bar 3. Verify File Location: Ensure tools/ReiLua_API.lua is in the workspace 4. Check Console: Open Zed's log to see LSP errors

-

Performance Issues

-

If the language server is slow:

-
{
-  "lsp": {
-    "lua-language-server": {
-      "settings": {
-        "Lua.workspace.maxPreload": 2000,
-        "Lua.workspace.preloadFileSize": 1000
-      }
-    }
-  }
-}
-
-

Missing Documentation

-

Ensure hover is enabled:

-
{
-  "hover_popover_enabled": true
-}
-
-

---

-

Advanced: Custom Annotations

-

You can extend tools/ReiLua_API.lua with your own game types:

-
---@class Player
----@field x number
----@field y number
----@field health number
-
----@class Enemy
----@field x number
----@field y number
----@field damage number
-
--- Your game globals
----@type Player
-player = {}
-
----@type Enemy[]
-enemies = {}
-
-

---

-

Keyboard Shortcuts in Zed

- -

---

-

Additional Resources

- -

---

-

Example Project Structure

-
my-reilua-game/
-├── .luarc.json              # LuaLS configuration
-├── .zed/
-│   └── settings.json        # Zed-specific settings
-├── tools/ReiLua_API.lua           # API definitions (copy from ReiLua)
-├── main.lua                 # Your game entry point
-├── player.lua
-├── enemy.lua
-└── assets/
-    ├── sprites/
-    └── sounds/
-
-

---

-

Quick Start Template

-

Save this as .luarc.json in your project:

-
{
-  "runtime.version": "Lua 5.4",
-  "completion.enable": true,
-  "completion.callSnippet": "Replace",
-  "diagnostics.globals": ["RL"],
-  "diagnostics.disable": [
-    "lowercase-global",
-    "duplicate-set-field",
-    "missing-fields"
-  ],
-  "workspace.checkThirdParty": false,
-  "workspace.library": ["."],
-  "hint.enable": true
-}
-
-

Save this as .zed/settings.json:

-
{
-  "lsp": {
-    "lua-language-server": {
-      "settings": {
-        "Lua.hint.enable": true,
-        "Lua.hint.paramName": "All",
-        "Lua.hint.setType": true,
-        "Lua.diagnostics.disable": [
-          "lowercase-global",
-          "duplicate-set-field",
-          "missing-fields"
-        ]
-      }
-    }
-  },
-  "inlay_hints": {
-    "enabled": true
-  }
-}
-
-

Then copy tools/ReiLua_API.lua to your project root, and you're ready to go!

-

---

-

Happy Coding!

-
\ No newline at end of file -- cgit v1.2.3