This is Lua 5.4.6, wrapped as a Go package.
It's experimental and suited to fit my needs.
go get zombiezen.com/go/luaimport "zombiezen.com/go/lua"
// Create an execution environment
// and make the standard libraries available.
state := new(lua.State)
defer state.Close()
if err := lua.OpenLibraries(state); err != nil {
return err
}
// Load Lua code as a chunk/function.
// Calling this function then executes it.
const luaSource = `print("Hello, World!")`
if err := state.LoadString(luaSource, luaSource, "t"); err != nil {
return err
}
if err := state.Call(0, 0, 0); err != nil {
return err
}MIT for compatibility with Lua itself.