package
0.2.4
Repository: https://github.com/spy16/pkg.git
Documentation: pkg.go.dev

# README

Lua

An easy-to-use wrapper for gopher-lua that provides easy interoperability between Lua and Go.

Usage

package main

import "github.com/spy16/pkg/lua"

func main() {
	luaState, _ := lua.New(
		lua.Path("/Users/bob/lua-lib"),
		lua.Module("http", httpClient{}),
	)

	_ = luaState.Execute(`print("hello")`)
}

# Functions

Context sets a context to be used by the lua state.
Globals sets all values in the map as global variables in the lua state.
Module defines a Lua module with public struct fields and methods exported.
New returns a new Lua instance initialised.
Path appends the given directories to LUA_PATH in correct format.

# Structs

Lua is a wrapper around lua-state and provides functions for managing state and executing lua code.

# Type aliases

Option can be provided to New() to customise initialization of Lua state.