Skip to content

zombiezen/go-lua

Repository files navigation

zombiezen.com/go/lua

This is Lua 5.4.6, wrapped as a Go package.

It's experimental and suited to fit my needs.

Install

go get zombiezen.com/go/lua

Getting Started

import "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
}

License

MIT for compatibility with Lua itself.

About

Lua wrapped as Go package

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages