lua

package
v0.0.0-...-b5e2f65 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2017 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const ARCH = runtime.GOARCH
View Source
const PLATFORM = runtime.GOOS
View Source
const ShvModuleName = "shv"

Variables

View Source
var NoTableError = xrror.Xrror("no table named %s").Out
View Source
var ResourceFS *bindataFS = &bindataFS{
	prefix: "",
	tree:   _bintree,
	data:   _bindata,
}

Functions

func NewProperty

func NewProperty(get, set l.LGFunction) l.LGFunction

func PushNewUserData

func PushNewUserData(L *l.LState, fn TakeUserData, mt string)

Types

type AssetDirectory

type AssetDirectory struct {
	AssetFile
	ChildrenRead int
	Children     []os.FileInfo
}

func NewAssetDirectory

func NewAssetDirectory(name string, children []string, fs *bindataFS) *AssetDirectory

func (*AssetDirectory) Readdir

func (f *AssetDirectory) Readdir(count int) ([]os.FileInfo, error)

func (*AssetDirectory) Stat

func (f *AssetDirectory) Stat() (os.FileInfo, error)

type AssetFile

type AssetFile struct {
	*bytes.Reader
	io.Closer
	FakeFile
}

func NewAssetFile

func NewAssetFile(name string, content []byte) *AssetFile

func (*AssetFile) Readdir

func (f *AssetFile) Readdir(count int) ([]os.FileInfo, error)

func (*AssetFile) Size

func (f *AssetFile) Size() int64

func (*AssetFile) Stat

func (f *AssetFile) Stat() (os.FileInfo, error)

type Config

type Config interface {
	Order() int
	Configure(*Lua) error
}

func DefaultConfig

func DefaultConfig(fn ConfigFn) Config

func NewConfig

func NewConfig(order int, fn ConfigFn) Config

func SetDetails

func SetDetails(version, platform, arch string) Config

func SetModules

func SetModules(g ...GetModule) Config

func SetPath

func SetPath(k, v string) Config

type ConfigFn

type ConfigFn func(*Lua) error

type Configuration

type Configuration interface {
	Add(...Config)
	AddFn(...ConfigFn)
	Configure() error
	Configured() bool
}

type Detail

type Detail struct {
	Key, Value string
}

type FakeFile

type FakeFile struct {
	Path string
	Dir  bool
	Len  int64
}

func (*FakeFile) IsDir

func (f *FakeFile) IsDir() bool

func (*FakeFile) ModTime

func (f *FakeFile) ModTime() time.Time

func (*FakeFile) Mode

func (f *FakeFile) Mode() os.FileMode

func (*FakeFile) Name

func (f *FakeFile) Name() string

func (*FakeFile) Size

func (f *FakeFile) Size() int64

func (*FakeFile) Sys

func (f *FakeFile) Sys() interface{}

type GetModule

type GetModule func(*Lua) Module

type LMetaFunc

type LMetaFunc struct {
	Key   string
	Value MetaLGFunc
}

func DefaultIdx

func DefaultIdx(tag string) *LMetaFunc

func ImmutableNewIdx

func ImmutableNewIdx() *LMetaFunc

type Lua

type Lua struct {
	Configuration
	*l.LState
}

func New

func New(debug bool, cnf ...Config) (*Lua, error)

func (*Lua) CallShv

func (L *Lua) CallShv(fn string, nargs, nresults int) error

func (*Lua) CallWithTraceback

func (L *Lua) CallWithTraceback(nargs, nresults int) error

func (*Lua) CheckNargs

func (L *Lua) CheckNargs(n int)

func (*Lua) GetModule

func (L *Lua) GetModule(name string) (*l.LTable, error)

func (*Lua) PushString

func (L *Lua) PushString(s string)

func (*Lua) RegisterFuncsOn

func (L *Lua) RegisterFuncsOn(name string, funcs map[string]l.LGFunction)

func (*Lua) RegistryIndex

func (L *Lua) RegistryIndex() *l.LTable

func (*Lua) RequireFn

func (L *Lua) RequireFn() *l.LFunction

func (*Lua) TracebackFn

func (L *Lua) TracebackFn() *l.LFunction

type MLoadEmb

type MLoadEmb func(*Lua) error

type MLoadMT

type MLoadMT func(*l.LState, Module)

type MLoader

type MLoader func(*l.LState) int

type MetaLGFunc

type MetaLGFunc func(*Table, string) l.LGFunction

type Module

type Module interface {
	Tag() string
	AddLGFunc(string, l.LGFunction)
	Loader(*l.LState) int
	AddMT(...MLoadMT)
	LoadMT(*l.LState)
	Register(*l.LState, *Table)
	AddEmb(...MLoadEmb)
	LoadEmb(*Lua) error
}
var (
	ShvModule Module = mkShvModule()
)

func NewModule

func NewModule(name string, mlr MLoader) Module

type RegisterWith

type RegisterWith func(Module) error

type Table

type Table struct {
	Name     string
	Parent   []*Table
	Meta     []*LMetaFunc
	Property map[string]l.LGFunction
	Method   map[string]l.LGFunction
}

func NewTable

func NewTable(
	name string,
	parent []*Table,
	meta []*LMetaFunc,
	prop, meth map[string]l.LGFunction,
) *Table

func (*Table) Execute

func (t *Table) Execute(L *l.LState) int

type Tables

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

func NewTables

func NewTables() *Tables

func (*Tables) Get

func (t *Tables) Get(k string) *Table

func (*Tables) Register

func (t *Tables) Register(L *l.LState, tbl *Table)

func (*Tables) Set

func (t *Tables) Set(tbl *Table)

type TakeUserData

type TakeUserData func(*l.LUserData)

Jump to

Keyboard shortcuts

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