vadv / gopher-lua-libs

Libs for gopher lua

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gopher-lua-libs

GoDoc

Package contains is a libs for gopher-lua.

License

Development version, available on github, released under BSD 3-clause.

Installation

go get github.com/vadv/gopher-lua-libs

Index

Usage

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)
        }
}

About

Libs for gopher lua

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Go 68.5%Language:Lua 31.3%Language:Shell 0.2%Language:Dockerfile 0.0%Language:HTML 0.0%