Alpha -- GoudEngine is under active development. APIs change frequently. Report issues
This guide covers installing the Lua SDK, running scripts through the embedded runner, and using the core engine APIs from Lua.
See also: C# guide -- Python guide -- TypeScript guide -- Rust guide -- Swift guide -- Go guide -- Kotlin guide
- Lua 5.4 or later
- LuaRocks 3.x (for standalone module installation)
- Rust toolchain -- needed to build the native engine library
The Lua SDK uses mlua to embed Lua 5.4 inside the Rust engine. There are two ways to use it:
- Embedded runner (recommended for games) -- The
lua-runnerbinary loads your Lua scripts and registers all engine bindings as globals automatically. - Standalone module (via LuaRocks) -- A
require-able module for standalone Lua interpreters that provides key constants and version info.
git clone https://github.com/aram-devdocs/GoudEngine.git
cd GoudEngine
cargo build --releaseThe embedded runner is built as part of the engine. No separate installation is needed:
cargo build --release
# The runner is at examples/lua/runner/For standalone Lua scripts that need key constants:
cd sdks/lua
luarocks make goudengine-scm-1.rockspecOr build manually:
cd sdks/lua/luarocks
make # builds the native library via cargo
make install # installs Lua modules and the native libraryCreate main.lua:
-- When running through the embedded runner, engine globals are
-- registered automatically. No require() needed.
local SCREEN_W = 800
local SCREEN_H = 600
-- The game loop is driven by the embedded runtime.
-- on_update is called every frame with delta time.
function on_init()
-- Called once when the script loads.
-- Load textures, set up initial state here.
end
function on_update(dt)
-- Called every frame.
-- dt is the elapsed seconds since the last frame.
if is_key_just_pressed(Key.escape) then
request_close()
end
end
function on_draw()
-- Called every frame after on_update.
-- Draw sprites and shapes here.
endRun it through the embedded runner:
./dev.sh --sdk lua --game flappy_birdLoad textures in on_init, then draw each frame in on_draw.
local player_tex
function on_init()
player_tex = load_texture("assets/player.png")
end
function on_draw()
draw_sprite(player_tex, 400, 300, 64, 64, 0)
enddraw_sprite takes the texture handle, center x, center y, width, height, and rotation in radians.
function on_update(dt)
-- One-shot: true only on the frame the key goes down
if is_key_just_pressed(Key.space) then
-- jump
end
-- Held: true every frame the key is down
if is_key_pressed(Key.w) then
y = y - speed * dt
end
if is_key_pressed(Key.s) then
y = y + speed * dt
end
if is_key_pressed(Key.a) then
x = x - speed * dt
end
if is_key_pressed(Key.d) then
x = x + speed * dt
end
endfunction on_update(dt)
if is_mouse_button_pressed(MouseButton.left) then
local mx = mouse_x()
local my = mouse_y()
-- click action at (mx, my)
end
endFor standalone scripts that only need constants (not the full engine runtime):
local goud = require("goudengine")
print(goud.VERSION) -- "0.0.832"
-- Access key constants
local Key = goud.constants.key
print(Key.space) -- 32The repository includes a complete Flappy Bird clone in Lua:
git clone https://github.com/aram-devdocs/GoudEngine.git
cd GoudEngine
cargo build --release
./dev.sh --sdk lua --game flappy_birdSource is in examples/lua/flappy_bird/.
| Platform | Library | Status |
|---|---|---|
| macOS | libgoud_engine.dylib | Supported |
| Linux | libgoud_engine.so | Supported |
| Windows | goud_engine.dll | Experimental |
The Lua SDK constants module is auto-generated by codegen/gen_lua.py. Do not hand-edit the generated files. Regenerate with:
python3 codegen/gen_lua.py- Lua SDK README -- Lua SDK documentation
- Lua examples source -- complete game source code
- Build Your First Game -- end-to-end minimal game walkthrough
- Example Showcase -- current cross-language parity matrix
- SDK-first architecture -- how the engine layers fit together
- Development guide -- building from source, version management, git hooks
- Other getting started guides: C# -- Python -- TypeScript -- Rust -- Swift -- Go -- Kotlin