feat(runtime): embed platform modules as bytecode
ui.lua and hints.lua are compiled to LUA_32BITS bytecode (matching the firmware's Lua build) and linked into the binary. A new package.searchers entry checks them as the fallback after the SD card, so a local /.lua/lib/ui.lua still shadows the packaged one for debugging. Bytecode is ~40% smaller than source and loads without parsing. A fresh SD card with no make sdcard now has the platform available.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
namespace esp32lua {
|
||||
|
||||
// A platform module compiled to bytecode and linked into the firmware. The module searcher
|
||||
// tries the SD card first, so a local copy shadows the packaged one.
|
||||
struct EmbeddedModule {
|
||||
const char* name;
|
||||
const unsigned char* data;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
extern const EmbeddedModule embedded_modules[];
|
||||
extern const size_t embedded_modules_count;
|
||||
|
||||
} // namespace esp32lua
|
||||
Reference in New Issue
Block a user