Skip to content

Lua scripts

cap_lua manages a sandboxed Lua root (demo: /fatfs/scripts/), exposing tools to list, edit, and run scripts synchronously or asynchronously. Paths are validated—only .lua files under the root run.

Which native hooks scripts can call (GPIO, delays, publishing events to the router, …) depends on registered lua_module_* modules. claw_event_router’s run_script action can also launch Lua without the LLM.

basic_demo comes with several example scripts:

  • camera_preview_demo.lua: demonstrates combined usage of camera, display, board_manager, and delay.
  • system_demo.lua: demonstrates reading time, uptime, IP, and memory/Wi‑Fi information from the system module.
  • clock_dial_demo.lua / flappybird.lua: comprehensive demos of display rendering and script interaction.