Skip to content

kjx98/cgo-lua

Repository files navigation

cgo-lua

A Go(lang) wrapper for LuaJit-2.x(Lua JIT Library) which is often used for embed script support. Forked from [RyouZhang] (https://github.com/RyouZhang/go-lua)

Build Status GoDoc

To use the library you need LuaJit 2.0/2.1 installed.

Example

package main

import (
	"fmt"
	"github.com/kjx98/cgo-lua"
)


func main() {
	res, err := lua.Call("script.lua", "test_args", 69)
	if err != nil {
		fmt.Println("test_args", err)
	} else {
		fmt.Println(res)
	}
}

Installing

Install the dependencies then run

$ go install github.com/kjx98/cgo-lua

Dependencies

To use luajit for go, you need to have the Luajit-2.x already installed:

Mac OS X
$ brew install luajit
Linux

Install from your package manager or install from source.

On Debian/Ubuntu/Fedora Linux luajit-2.1 is available from the distro.

To compile first download Luajit-2.1 and:

$ untar and cd
$ make
$ sudo make install

License

Copyright (c) 2018 Jesse Kuang

About

goland bind for luaJIT (2.1 and 2.0)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published