Help us shape the future of Go! Take the 2026 Go Developer Survey

convert

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToBool

func ToBool(val lua.LValue) bool

ToBool converts a Lua value to a Go bool. Uses Lua's boolean semantics (only nil and false are false).

func ToGoValue

func ToGoValue(val lua.LValue) any

ToGoValue converts a Lua value to the best associated Go type. This is the primary function for Lua → Go conversion.

Based on dragon-mud's AsRaw pattern: - LTString → string - LTBool → bool - LTNil → nil - LTNumber → float64 - LTTable → map[string]any or []any (based on structure)

func ToLuaValue

func ToLuaValue(L *lua.LState, val any) lua.LValue

ToLuaValue converts a Go value to a Lua value. This is the primary function for Go → Lua conversion. Supports primitives, maps, slices, and nested structures.

Inspired by dragon-mud's getLValue and ValueFor pattern.

func ToNumber

func ToNumber(val lua.LValue) float64

ToNumber converts a Lua value to a Go float64. Uses Lua's built-in number conversion rules.

func ToString

func ToString(val lua.LValue) string

ToString converts a Lua value to a Go string. Uses Lua's built-in string conversion rules.

Types

This section is empty.

Jump to

Keyboard shortcuts

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