luax

package
v0.0.0-...-734a412 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNil

func IsNil(v lua.LValue) bool

IsNil checks if the lua.LValue is nil or represents lua.LNil.

func LTableGetBool

func LTableGetBool(t *lua.LTable, key string) bool

LTableGetBool is a convenience function to get a bool value from a lua.LTable using a string key.

func LTableGetFloat32

func LTableGetFloat32(t *lua.LTable, key string) float32

LTableGetFloat32 is a convenience function to get a float32 value from a lua.LTable using a string key.

func LTableGetFloat64

func LTableGetFloat64(t *lua.LTable, key string) float64

LTableGetFloat64 is a convenience function to get a float64 value from a lua.LTable using a string key.

func LTableGetInt

func LTableGetInt(t *lua.LTable, key string) int

LTableGetInt is a convenience function to get an int value from a lua.LTable using a string key.

func LTableGetInt16

func LTableGetInt16(t *lua.LTable, key string) int16

LTableGetInt16 is a convenience function to get an int16 value from a lua.LTable using a string key.

func LTableGetInt32

func LTableGetInt32(t *lua.LTable, key string) int32

LTableGetInt32 is a convenience function to get an int32 value from a lua.LTable using a string key.

func LTableGetInt64

func LTableGetInt64(t *lua.LTable, key string) int64

LTableGetInt64 is a convenience function to get an int64 value from a lua.LTable using a string key.

func LTableGetInt8

func LTableGetInt8(t *lua.LTable, key string) int8

LTableGetInt8 is a convenience function to get an int8 value from a lua.LTable using a string key.

func LTableGetString

func LTableGetString(t *lua.LTable, key string) string

LTableGetString is a convenience function to get a string value from a lua.LTable using a string key.

func LTableGetUint

func LTableGetUint(t *lua.LTable, key string) uint

LTableGetUint is a convenience function to get a uint value from a lua.LTable using a string key.

func LTableGetUint16

func LTableGetUint16(t *lua.LTable, key string) uint16

LTableGetUint16 is a convenience function to get a uint16 value from a lua.LTable using a string key.

func LTableGetUint32

func LTableGetUint32(t *lua.LTable, key string) uint32

LTableGetUint32 is a convenience function to get a uint32 value from a lua.LTable using a string key.

func LTableGetUint64

func LTableGetUint64(t *lua.LTable, key string) uint64

LTableGetUint64 is a convenience function to get a uint64 value from a lua.LTable using a string key.

func LTableGetUint8

func LTableGetUint8(t *lua.LTable, key string) uint8

LTableGetUint8 is a convenience function to get a uint8 value from a lua.LTable using a string key.

func LTableToDict

func LTableToDict(t *lua.LTable) map[Value]Value

LTableToDict converts the lua.LTable to a map of Value to Value.

func LTableToMap

func LTableToMap(t *lua.LTable) map[string]Value

LTableToMap converts the lua.LTable to a map of string to Value.

func LValueToBool

func LValueToBool(v lua.LValue) bool

LValueToBool retrieves the bool value from a lua.LValue.

func LValueToDict

func LValueToDict(v lua.LValue) map[Value]Value

LValueToDict retrieves the dict of value from a lua.LValue.

func LValueToFloat32

func LValueToFloat32(v lua.LValue) float32

LValueToFloat32 retrieves the float32 value from a lua.LValue.

func LValueToFloat64

func LValueToFloat64(v lua.LValue) float64

LValueToFloat64 retrieves the float64 value from a lua.LValue.

func LValueToInt

func LValueToInt(v lua.LValue) int

LValueToInt retrieves the int value from a lua.LValue.

func LValueToInt16

func LValueToInt16(v lua.LValue) int16

LValueToInt16 retrieves the int16 value from a lua.LValue.

func LValueToInt32

func LValueToInt32(v lua.LValue) int32

LValueToInt32 retrieves the int32 value from a lua.LValue.

func LValueToInt64

func LValueToInt64(v lua.LValue) int64

LValueToInt64 retrieves the int64 value from a lua.LValue.

func LValueToInt8

func LValueToInt8(v lua.LValue) int8

LValueToInt8 retrieves the int8 value from a lua.LValue.

func LValueToMap

func LValueToMap(v lua.LValue) map[string]Value

LValueToMap retrieves the map of value from a lua.LValue.

func LValueToString

func LValueToString(v lua.LValue) string

LValueToString retrieves the string value from a lua.LValue.

func LValueToUint

func LValueToUint(v lua.LValue) uint

LValueToUint retrieves the uint value from a lua.LValue.

func LValueToUint16

func LValueToUint16(v lua.LValue) uint16

LValueToUint16 retrieves the uint16 value from a lua.LValue.

func LValueToUint32

func LValueToUint32(v lua.LValue) uint32

LValueToUint32 retrieves the uint32 value from a lua.LValue.

func LValueToUint64

func LValueToUint64(v lua.LValue) uint64

LValueToUint64 retrieves the uint64 value from a lua.LValue.

func LValueToUint8

func LValueToUint8(v lua.LValue) uint8

LValueToUint8 retrieves the uint8 value from a lua.LValue.

Types

type Options

type Options = lua.Options

Options is an alias for lua.Options to represent the options used when creating a Lua VM.

type Table

type Table struct {
	// contains filtered or unexported fields
}

Table is a wrapper type for lua.LTable

func LTable

func LTable(t *lua.LTable) Table

LTable converts a lua.LTable to a Table wrapper.

func LTableGetTable

func LTableGetTable(t *lua.LTable, key string) Table

LTableGetTable is a convenience function to get a table value from a lua.LTable using a string key.

func LValueToTable

func LValueToTable(v lua.LValue) Table

LValueToTable retrieves the map of value from a lua.LValue.

func (Table) ArrayForEach

func (t Table) ArrayForEach(fn func(k int, v Value))

ArrayForEach iterates over the table array using a function.

func (Table) ArrayLen

func (t Table) ArrayLen() int

ArrayLen returns the length of the table array.

func (Table) DictForEach

func (t Table) DictForEach(fn func(k, v Value))

DictForEach iterates over the table dict using a function.

func (Table) DictLen

func (t Table) DictLen() int

DictLen returns the length of the table dict. due to the limitation of Lua virtual machine, we can only traverse to get the length

func (Table) ForEach

func (t Table) ForEach(fn func(k, v Value))

ForEach iterates over the table using a function.

func (Table) Get

func (t Table) Get(key string) Value

Get retrieves a value from the table using a string key.

func (Table) GetBool

func (t Table) GetBool(key string) bool

GetBool retrieves a bool value from the table using a string key.

func (Table) GetFloat32

func (t Table) GetFloat32(key string) float32

GetFloat32 retrieves a float32 value from the table using a string key.

func (Table) GetFloat64

func (t Table) GetFloat64(key string) float64

GetFloat64 retrieves a float64 value from the table using a string key.

func (Table) GetInt

func (t Table) GetInt(key string) int

GetInt retrieves an int value from the table using a string key.

func (Table) GetInt16

func (t Table) GetInt16(key string) int16

GetInt16 retrieves an int16 value from the table using a string key.

func (Table) GetInt32

func (t Table) GetInt32(key string) int32

GetInt32 retrieves an int32 value from the table using a string key.

func (Table) GetInt64

func (t Table) GetInt64(key string) int64

GetInt64 retrieves an int64 value from the table using a string key.

func (Table) GetInt8

func (t Table) GetInt8(key string) int8

GetInt8 retrieves an int8 value from the table using a string key.

func (Table) GetString

func (t Table) GetString(key string) string

GetString retrieves a string value from the table using a string key.

func (Table) GetTable

func (t Table) GetTable(key string) Table

GetTable retrieves a nested table from the table using a string key.

func (Table) GetUint

func (t Table) GetUint(key string) uint

GetUint retrieves a uint value from the table using a string key.

func (Table) GetUint16

func (t Table) GetUint16(key string) uint16

GetUint16 retrieves a uint16 value from the table using a string key.

func (Table) GetUint32

func (t Table) GetUint32(key string) uint32

GetUint32 retrieves a uint32 value from the table using a string key.

func (Table) GetUint64

func (t Table) GetUint64(key string) uint64

GetUint64 retrieves a uint64 value from the table using a string key.

func (Table) GetUint8

func (t Table) GetUint8(key string) uint8

GetUint8 retrieves a uint8 value from the table using a string key.

func (Table) Index

func (t Table) Index(index int) Value

Index retrieves a value from the table using an integer index.

func (Table) LTable

func (t Table) LTable() *lua.LTable

LTable converts the Table back to a *lua.LTable.

func (Table) MapForEach

func (t Table) MapForEach(fn func(k string, v Value))

MapForEach iterates over the table map using a function.

func (Table) MapLen

func (t Table) MapLen() int

MapLen returns the length of the table map. due to the limitation of Lua virtual machine, we can only traverse to get the length

func (Table) Next

func (t Table) Next(key Value) (Value, Value)

Next retrieves the next key-value pair in the table after a given key.

func (Table) ToArray

func (t Table) ToArray() []Value

ToArray converts the table into a slice of Value.

func (Table) ToDict

func (t Table) ToDict() map[Value]Value

ToDict converts the table into a map of Value to Value.

func (Table) ToMap

func (t Table) ToMap() map[string]Value

ToMap converts the table into a map of string to Value.

type VM

type VM = lua.LState

VM is an alias for lua.LState to represent the Lua virtual machine.

func NewVM

func NewVM(opts ...Options) *VM

NewVM creates a new Lua virtual machine (VM) instance.

type Value

type Value struct {
	// contains filtered or unexported fields
}

Value is a custom type that wraps a lua.LValue.

func LTableGet

func LTableGet(t *lua.LTable, key string) Value

LTableGet is a convenience function to get a value from a lua.LTable using a string key.

func LTableIndex

func LTableIndex(t *lua.LTable, i int) Value

LTableIndex is a convenience function to get a value from a lua.LTable using an int key.

func LTableToArray

func LTableToArray(t *lua.LTable) []Value

LTableToArray converts the lua.LTable to a slice of Value.

func LValue

func LValue(v lua.LValue) Value

LValue wraps a lua.LValue and returns a custom Value type.

func LValueToArray

func LValueToArray(v lua.LValue) []Value

LValueToArray retrieves the array of value from a lua.LValue

func (Value) IsNil

func (v Value) IsNil() bool

IsNil checks if the wrapped lua.LValue is nil or represents lua.LNil.

func (Value) LValue

func (v Value) LValue() lua.LValue

LValue returns the underlying lua.LValue.

func (Value) String

func (v Value) String() string

String returns the string representation of the wrapped value if it's not nil, otherwise an empty string.

func (Value) ToBool

func (v Value) ToBool() bool

ToBool retrieves the bool value from the wrapped lua.LValue if it's of type boolean.

func (Value) ToFloat32

func (v Value) ToFloat32() float32

ToFloat32 retrieves the float32 value from the wrapped lua.LValue if it's of type number.

func (Value) ToFloat64

func (v Value) ToFloat64() float64

ToFloat64 retrieves the float64 value from the wrapped lua.LValue if it's of type number.

func (Value) ToInt

func (v Value) ToInt() int

ToInt retrieves the int value from the wrapped lua.LValue if it's of type number.

func (Value) ToInt16

func (v Value) ToInt16() int16

ToInt16 retrieves the int16 value from the wrapped lua.LValue if it's of type number.

func (Value) ToInt32

func (v Value) ToInt32() int32

ToInt32 retrieves the int32 value from the wrapped lua.LValue if it's of type number.

func (Value) ToInt64

func (v Value) ToInt64() int64

ToInt64 retrieves the int64 value from the wrapped lua.LValue if it's of type number.

func (Value) ToInt8

func (v Value) ToInt8() int8

ToInt8 retrieves the int8 value from the wrapped lua.LValue if it's of type number.

func (Value) ToString

func (v Value) ToString() string

ToString retrieves the string value from the wrapped lua.LValue if it's of type string.

func (Value) ToTable

func (v Value) ToTable() Table

ToTable retrieves the table value from the wrapped lua.LValue if it's of type table.

func (Value) ToUint

func (v Value) ToUint() uint

ToUint retrieves the uint value from the wrapped lua.LValue if it's of type number.

func (Value) ToUint16

func (v Value) ToUint16() uint16

ToUint16 retrieves the uint16 value from the wrapped lua.LValue if it's of type number.

func (Value) ToUint32

func (v Value) ToUint32() uint32

ToUint32 retrieves the uint32 value from the wrapped lua.LValue if it's of type number.

func (Value) ToUint64

func (v Value) ToUint64() uint64

ToUint64 retrieves the uint64 value from the wrapped lua.LValue if it's of type number.

func (Value) ToUint8

func (v Value) ToUint8() uint8

ToUint8 retrieves the uint8 value from the wrapped lua.LValue if it's of type number.

func (Value) Type

func (v Value) Type() lua.LValueType

Type returns the type of the wrapped lua.LValue.

Jump to

Keyboard shortcuts

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