What problem does it solve?
This Skill helps you implement, debug, and harden Lua scripting inside Megahub so ESP32 firmware can run user scripts reliably without breaking device control or memory stability.
Core Features & Use Cases
- Lua runtime integration: Understand how Megahub creates a Lua 5.4 state, loads libraries, and executes scripts through the firmware entry points.
- Custom bindings and APIs: Work with the Megahub Lua bridge, including hub.init and hub.startthread for initialization and coroutine-based background tasks.
- Blockly to Lua pipeline: Trace how browser-generated Lua code is produced, transmitted over BLE, and executed on the device.
- Safety and stability: Apply the required error handling, pcall usage, stack sizing, and heap-aware practices that keep the firmware responsive.
- Use case: Update a Blockly-generated motor control flow so it launches a monitoring thread, handles Lua errors cleanly, and avoids starving other ESP32 tasks.
Quick Start
Use this Skill to trace how a Lua script moves from Blockly or BLE into Megahub firmware, then adjust the bindings, error handling, or thread settings needed for your change.