go-lua is a Lua VM in pure Go that ports the Lua 5.2 virtual machine to Go and maintains compatibility with binary files produced by the standard Lua compiler.
The project solves the problem of embedding scripting capabilities into Go applications without requiring C bindings or external Lua installations. It achieves this by implementing a complete port of the Lua 5.2 VM in pure Go, including both the compiler and bytecode interpreter. The implementation uses Go's heap for Lua objects and includes debug hooks throughout the execution engine.
Developers should choose this tool when they need to embed Lua scripting directly into Go applications without external dependencies. It suits projects that require simple scripting of Go behavior, as demonstrated by its production use in Shopify's load generation and resiliency tooling. The README compares performance against the C reference implementation and Gopher-lua, noting that go-lua runs recursive Fibonacci roughly six times slower than C Lua and about twenty percent slower than Gopher-lua, with the gap widening in bytecode-heavy workloads. Most core Lua libraries are at least partially implemented, though regular expressions, coroutines, and string.dump are not supported. Weak reference tables are explicitly not supported due to Go's lack of weak reference support.
The project has been battle-tested in production environments since its initial deployment. The compiler successfully processes all Lua test suite files, while the VM correctly executes over a third of the test cases. Development maintains a focus on correctness and compatibility with the Lua specification, as evidenced by the comprehensive test coverage against the official Lua test suite. The performance characteristics stem from deliberate architectural choices, particularly the heap allocation of stack frames with separate variant structs, which prioritize compatibility and debugging capability over raw speed.