parser

package module
v0.0.0-...-19d77dd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2021 License: MIT Imports: 3 Imported by: 0

README

go-lua-table-parser

A simple go package which takes a lua table as input and parses it to a map[string]interface{} where interface{} is either more map[string]interface{} or map[string]string.

This package uses the github.com/yuin/gopher-lua package.

Usage:

import parser "github.com/uberswe/go-lua-table-parser"

luaString := `Vars =
{
    ["key"] = 
    {
        ["someOtherKey"] = "value"
    }
}`

func main() {
    parser.Parse(luaString, "Vars")
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(s string, variable string) (map[string]interface{}, error)

Parse takes a lua table as a string (s) and then the variable name of the lua table as arguments and returns a map[string]interface{} where interface{} is either more map[string]interface{} or map[string]string

func ParseByLState

func ParseByLState(l *lua.LState, variable string) (map[string]interface{}, error)

ParseByLState require "*lua.LState" and the name of table/variable

func ParseFile

func ParseFile(f *os.File, variable string) (map[string]interface{}, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL