Announcing go-lua - Shopify

This post details the creation of go-lua, a pure Go implementation of the Lua 5.2 programming language, to serve as the core execution engine for Shopify's load generation tool. It outlines the motivation for choosing Go and Lua, the manual porting process of the Lua compiler and VM from C to Go, and the advantages of a pure Go implementation (GC integration, minimal context overhead, concurrency mapping). It also discusses challenges related to Go compiler optimizations for switch statements and function inlining, leading to performance tuning via function table dispatch and manual inlining. Examples of Lua table manipulation and Go standard library integration (regexp) are provided. Benchmarks comparing go-lua to C Lua and gopher-lua are presented, along with limitations such as the absence of coroutines and weak references.