convert

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package convert provides functions for converting to and from Lua structures

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Arguments2buffer

func Arguments2buffer(L *lua.LState, addNewline bool) bytes.Buffer

Arguments2buffer retrieves all the arguments given to a Lua function and gather the strings in a buffer.

func LValueMaps2table

func LValueMaps2table(L *lua.LState, maps []map[string]lua.LValue) *lua.LTable

LValueMaps2table converts a []map[string]lua.LValue to a Lua table

func Map2table

func Map2table(L *lua.LState, m map[string]string) *lua.LTable

Map2table converts a map[string]string to a Lua table

func PprintToWriter

func PprintToWriter(w io.Writer, value lua.LValue)

PprintToWriter outputs more informative information than the memory location. Attempt to extract and print the values of the given lua.LValue. Does not add a newline at the end.

func Strings2table

func Strings2table(L *lua.LState, sl []string) *lua.LTable

Strings2table converts a string slice to a Lua table

func Table2interfaceMap

func Table2interfaceMap(luaTable *lua.LTable) map[string]any

Table2interfaceMap converts a Lua table to a map[string]any If values are also tables, they are also attempted converted to map[string]any

func Table2interfaceMapGlua

func Table2interfaceMapGlua(luaTable *lua.LTable) (retmap map[any]any, isArray bool, err error)

Table2interfaceMapGlua converts a Lua table to a map by using gluamapper. If the map really is an array (all the keys are indices), return true.

func Table2map

func Table2map(luaTable *lua.LTable, preferInt bool) (any, bool)

Table2map converts a Lua table to **one** of the following types, depending on the content:

map[string]string
map[string]int
map[int]string
map[int]int

If no suitable keys and values are found, a nil interface is returned. If several different types are found, it returns true.

func Table2maps

func Table2maps(luaTable *lua.LTable) (map[string]string, map[string]int, map[int]string, map[int]int)

Table2maps converts a Lua table to **all** of the following types, depending on the content:

map[string]string
map[string]int
map[int]string
map[int]int

Types

This section is empty.

Jump to

Keyboard shortcuts

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