Libs for gopher lua
Package contains is a libs for gopher-lua.
Development version, available on github, released under BSD 3-clause.
go get github.com/vadv/gopher-lua-libs
For the quick overview you can use standalone interpreter with listed libs. Examples and documentation for modules can be found in their directories.
go install github.com/vadv/gopher-lua-libs/cmd/glua-libs@latest
glua-libs example.lua
This example shows basic usage of this libs in your code
package main
import (
"log"
"flag"
"os"
lua "github.com/yuin/gopher-lua"
libs "github.com/vadv/gopher-lua-libs"
)
var (
exec = flag.String("execute", "", "execute lua script")
)
func main() {
flag.Parse()
state := lua.NewState()
defer state.Close()
libs.Preload(state)
if *exec != `` {
if err := state.DoFile(*exec); err != nil {
log.Printf("[ERROR] Error executing file: ", err)
}
} else {
log.Println("Target file was not given!")
os.Exit(0)
}
}