Skip to content

feat(lua): EdgeTX Lua compiler#7275

Open
raphaelcoeffic wants to merge 2 commits intomainfrom
edgetx-luac
Open

feat(lua): EdgeTX Lua compiler#7275
raphaelcoeffic wants to merge 2 commits intomainfrom
edgetx-luac

Conversation

@raphaelcoeffic
Copy link
Copy Markdown
Member

This PR adds a standalone Lua compiler that can be used to pre-compile Lua scripts to save memory when running scripts on constrained devices (see #7251).

Build:

cmake -S radio/src/thirdparty/Lua -B build-luac
cmake --build build-luac

Usage:

edgetx-luac -s -o script.luac script.lua

Or just head to https://edgetx-luac.pages.dev.

raphaelcoeffic and others added 2 commits April 7, 2026 18:21
Add a standalone CMake build for luac that produces bytecode compatible
with EdgeTX's 32-bit Lua 5.3 (float numbers, int integers). This lets
users compile scripts on their host machine or in CI without needing
Companion, which is especially useful for memory-constrained radios
where on-radio compilation may fail due to insufficient RAM.

Build:
  cmake -S radio/src/thirdparty/Lua -B build-luac
  cmake --build build-luac

Usage:
  edgetx-luac -s -o script.luac script.lua

Changes:
- New radio/src/thirdparty/Lua/CMakeLists.txt for host build
- luaconf.h: guard EdgeTX debug.h behind LUA_HOST_BUILD
- luac.c: remove dangling lnodemcu.h include, guard alloca.h,
  fix use of uninitialized filelist[] (should be argv[])

Ref: #7251
Build edgetx-luac as a WebAssembly module so users can compile Lua
scripts to EdgeTX bytecode directly in their browser with no server.

- luac_wasm.c: thin C wrapper exposing compile/malloc/free exports
- build-wasm.sh: builds with wasi-sdk (-Os, gc-sections, sjlj)
- wasm/index.html: self-contained web app with editor, drag-and-drop,
  file upload, and .luac download (EdgeTX-branded)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@raphaelcoeffic raphaelcoeffic added enhancement ✨ New feature or request lua labels Apr 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement ✨ New feature or request lua

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant