Documentation
¶
Index ¶
- func PushReflectedValue(l *lua.State, val reflect.Value) (err error)
- func PushType(l *lua.State, example interface{}) error
- func PushValue(l *lua.State, val interface{}) error
- func SetOptions(l *lua.State, opts Options)
- func ToReflectedValue(l *lua.State, index int, hint reflect.Type) (result reflect.Value, err error)
- func ToValue(l *lua.State, index int, hint reflect.Type) (interface{}, error)
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PushReflectedValue ¶
PushReflectedValue is like PushValue, but works on already reflected values.
func PushType ¶
func PushType(l *lua.State, example interface{}) error
PushType pushes a constructor for the given example's type onto the Lua stack. Usually used like:
if err := PushType(l, Type{}); err == nil { l.SetGlobal("Type") }
func PushValue ¶
func PushValue(l *lua.State, val interface{}) error
PushValue pushes a Go value mapped to the appropriate Lua binding onto the Lua stack. Usually used like:
if err := PushValue(l, x); err == nil { l.SetGlobal("x") }
Will return an error if the conversion is not possible.
func SetOptions ¶
func SetOptions(l *lua.State, opts Options)
func ToReflectedValue ¶
func ToReflectedValue(l *lua.State, index int, hint reflect.Type) ( result reflect.Value, err error)
ToReflectedValue is like ToValue, but leaves the type as a reflect.Value. If hint is not nil, will use hint if possible to try and better inform the conversion (if hint is a slice and the lua value is a table, will simply get the numeric indexes).
func ToValue ¶
ToValue returns the reverse-mapped Go value from the Lua stack at index `index`, and an error if the conversion isn't yet possible. If hint is not nil, will use hint if possible to try and better inform the conversion (if hint is a slice and the lua value is a table, will simply get the numeric indexes).