Hilbish/moonlight/table_golua.go

30 lines
421 B
Go

package moonlight
import (
rt "github.com/arnodel/golua/runtime"
)
type Table struct{
lt *rt.Table
}
func NewTable() *Table {
return &Table{
lt: rt.NewTable(),
}
}
func (t *Table) Get(val Value) Value {
return t.lt.Get(val)
}
func (t *Table) SetField(key string, value Value) {
t.lt.Set(rt.StringValue(key), value)
}
func (mlr *Runtime) GlobalTable() *Table {
return &Table{
lt: mlr.rt.GlobalEnv(),
}
}