common

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const ScaledPointMetaTable = "ScaledPoint"

Variables

This section is empty.

Functions

func LuaTableToGo

func LuaTableToGo(l *lua.State, index int) any

LuaTableToGo converts a Lua table to a Go slice (for array-like tables with consecutive integer keys 1..n) or map[string]any (otherwise).

func LuaToGo

func LuaToGo(l *lua.State, index int) any

LuaToGo reads the Lua value at index and returns the Go equivalent. Tables become map[string]any or []any, numbers become int or float64, strings and booleans map directly.

func PushAny

func PushAny(l *lua.State, v any)

PushAny pushes a Go value onto the Lua stack as the corresponding Lua type. Supported types: nil, bool, float64, int, string, map[string]any, []any.

func PushScaledPoint

func PushScaledPoint(l *lua.State, sp bag.ScaledPoint)

PushScaledPoint creates a new ScaledPoint userdata and pushes it onto the stack

func RegisterScaledPointMetaTable

func RegisterScaledPointMetaTable(l *lua.State)

RegisterScaledPointMetaTable creates the ScaledPoint metatable

func SpFromString

func SpFromString(l *lua.State) int

SpFromString creates a ScaledPoint userdata from string: sp_string("12pt")

func SpMax

func SpMax(l *lua.State) int

SpMax returns the maximum of two ScaledPoints

func SpMin

func SpMin(l *lua.State) int

SpMin returns the minimum of two ScaledPoints

func SpNew

func SpNew(l *lua.State) int

SpNew creates a ScaledPoint userdata from pt: sp(points)

func ToScaledPointValue

func ToScaledPointValue(l *lua.State, index int) (bag.ScaledPoint, bool)

ToScaledPointValue converts a Lua value (ScaledPoint, string, or number) to bag.ScaledPoint Returns the value and true on success, or 0 and false on failure

Types

type ScaledPoint

type ScaledPoint struct {
	Value bag.ScaledPoint
}

ScaledPoint wraps bag.ScaledPoint as Lua userdata

func CheckScaledPoint

func CheckScaledPoint(l *lua.State, index int) *ScaledPoint

CheckScaledPoint retrieves a ScaledPoint userdata from the stack

func TestScaledPoint

func TestScaledPoint(l *lua.State, index int) *ScaledPoint

TestScaledPoint checks if the value at index is a ScaledPoint userdata

Jump to

Keyboard shortcuts

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