A Lua 5.1 VM and compiler written in Go, designed for embedding Lua scripting into Go applications.
GopherLua is a Lua 5.1 virtual machine and compiler implemented in Go. It allows developers to embed Lua as a scripting language directly into Go applications, enabling dynamic scripting capabilities within a Go runtime. The project solves the need for a lightweight, embeddable scripting engine that integrates seamlessly with Go's concurrency model and type system.
Go developers who need to add scripting or plugin capabilities to their applications, such as those building game engines, configuration systems, or extensible tools where Lua's simplicity and Go's performance are beneficial.
Developers choose GopherLua because it provides a pure-Go implementation of Lua with a clean, non-stack-based API that is easier to use than traditional Lua C bindings. It uniquely supports Go channels for inter-goroutine communication and allows sharing of compiled bytecode across multiple VM instances.
GopherLua: VM and compiler for Lua in Go
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Implements the complete Lua 5.1 specification plus the goto statement from Lua 5.2, ensuring broad script compatibility and adherence to standard Lua syntax.
Offers a non-stack-based API that simplifies calling Lua from Go and vice versa, prioritizing developer experience over raw performance as stated in the design principles.
Integrates Go-style channels for communication between goroutines and Lua scripts, enabling seamless concurrent scripting with channel operations detailed in the Lua API.
Supports Go's context package for canceling long-running scripts, providing control over execution timeouts, though with noted performance degradation.
Allows sharing compiled Lua bytecode across multiple LState instances to reduce memory footprint, with examples provided for compiling and reusing bytecode.
Admits to being 'not fast but not too slow' with benchmarks comparable to Python3, making it less suitable for latency-sensitive applications where raw speed is crucial.
Lacks support for functions like string.dump, os.setlocale, and debug hooks, which can break scripts reliant on these features and limit compatibility.
Requires manual tuning of registry and callstack sizes for optimal performance, adding overhead for developers and risking panics if misconfigured.
While community libraries exist, the ecosystem is smaller than native Lua's, potentially requiring custom implementations for missing modules or ports.