This presentation introduces LRocket, an open-source compiler for the Lua programming language designed to enhance its utility for robust, self-contained applications. Developed by Leso and Subaka, LRocket bundles Lua scripts and their recursive dependencies into standalone executables, shared libraries, and WebAssembly modules. Key features include advanced dependency tracing, static and dynamic linking (especially for C modules and system libraries), deep integration with Lua's package manager LuaRocks, and the ability to embed arbitrary resource files directly into the compiled output. Through various demonstrations, including a GTK image viewer and a complex WebAssembly-based event registration system, the creators showcase LRocket's power in simplifying Lua application distribution and cross-platform deployment, with ongoing efforts in comprehensive cross-compilation and optimization.
Summarizing Convenience Scripting with Lua and LRocket
0:00:11 Introducing LRocket: Leso and Subaka present LRocket, a hobby project evolved into a compiler for the interpreted Lua language, aiming to create more robust and compiled Lua executables.
0:01:09 LRocket's Core Functionality: The compiler bundles Lua code into standalone executables, shared libraries, and, notably, WebAssembly modules. It also introduces "quality of life" features like embedding resource files.
0:02:23 Compilation Process Overview: LRocket takes a Lua file, compiles it into a C file, and then generates an executable (e.g., ELF on Linux, PE on Windows). It can statically link the Lua runtime to reduce file count for distribution.
0:03:12 Differentiating from Alternatives: LRocket distinguishes itself from tools like Lua Static and Lua Pack by offering automatic, recursive dependency tracing and bundling, providing more comprehensive standalone executables. It also prioritizes independence from LuaRocks while offering deep integration.
0:04:32 Key Innovations: LRocket's key features include static linking for C module bindings (reducing reliance on external shared libraries), deep LuaRocks integration via a build plugin and hooking framework, and a new capability for embedding arbitrary resource files directly into the binary (inspired by Go Embed).
0:05:27 Cross-Compilation and WebAssembly: A major roadmap item is smart cross-compilation to various architectures, with WebAssembly already functional, allowing Lua logic to run directly in web browsers.
0:06:31 Automatic Dependency Resolution: LRocket recursively identifies and bundles all dependencies, even indirect ones, ensuring all necessary Lua and C modules are included in the final executable.
0:07:36 Streamlined LuaRocks Integration: A LuaRocks build plugin simplifies the compilation and installation of LRocket projects, automatically finding and packing dependencies. A hooking framework allows LuaRocks packages to be installed as static objects for static linking.
0:09:40 Embedding Arbitrary Files: A newly implemented feature (set for release soon) allows developers to embed resource files (e.g., text files) using specific comments, making them accessible via Lua's standard IO library within the compiled application.
0:11:01 Static Bindings Demo: Showcases a GTK image viewer application built with LRocket, demonstrating how C module bindings (LGI for GObject Introspection) are statically compiled, removing external shared library requirements.
0:12:43 Command-Line Tool Demo: A Lua-based document format converter packaged for Alpine Linux, illustrating LRocket's ability to create minimal, single-file command-line tools with inherent system dependencies.
0:13:33 WebAssembly Web Application Demo: A full-fledged event registration website with 100% Lua logic compiled to WebAssembly. It interacts with a separate Lua-compiled bot (via MQTT) for backend tasks like sending emails, demonstrating LRocket's capacity for complex web applications.
0:15:22 Current Status and Future Roadmap: LRocket currently supports compilation from Linux and Windows for native and WebAssembly targets. The roadmap includes comprehensive cross-compilation to platforms like Raspberry Pi and optimization features, such as embedding resources in specific executable sections.
0:17:49 LuaJIT Support: LRocket fully supports LuaJIT for native compilation, enabling high-performance Lua applications. (WebAssembly currently does not support LuaJIT, requiring standard Lua.)