luabox

package module
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const EReadonly = FsError("readonly filesystem")
View Source
const EnvKey = "LUABOX_ENV"

Variables

View Source
var BaseLibs map[string]LuaFile

Functions

func DeepPush

func DeepPush(l *lua.State, v interface{}) int

func EnvGetArgs

func EnvGetArgs(l *lua.State) int

func EnvGetEnv

func EnvGetEnv(l *lua.State) int

func LoadFile

func LoadFile(l *lua.State, fileName, mode string) error

func LoadLuaFile

func LoadLuaFile(l *lua.State, f LuaFile) error

func MustPullVarargs

func MustPullVarargs(l *lua.State, startIndex int) []interface{}

func PackageOpen

func PackageOpen(l *lua.State) int

PackageOpen opens the package library. Usually passed to Require.

func Parse

func Parse(l *lua.State) int

func ParseJson

func ParseJson(l *lua.State) int

func PullStringTable

func PullStringTable(l *lua.State, idx int) (map[string]string, error)

func PullTable

func PullTable(l *lua.State, idx int) (interface{}, error)

func PullVarargs

func PullVarargs(l *lua.State, startIndex int) ([]interface{}, error)

func Repr

func Repr(l *lua.State) int

func ReprJson

func ReprJson(l *lua.State) int

func ScanLibs

func ScanLibs(libDir string) (map[string]LuaFile, error)

func SetEnvironment

func SetEnvironment(l *lua.State, environment *Environment)

func SyscallOpen

func SyscallOpen(l *lua.State) int

Types

type Environment

type Environment struct {
	Fs         Filesystem
	Input      io.Reader
	Output     WriteSyncer
	Log        Log
	Env        map[string]string
	Args       []string
	Context    context.Context
	GoLibs     []lua.RegistryFunction
	LuaLibs    map[string]LuaFile
	PreInitLua []LuaFile
}

func GetEnvironment

func GetEnvironment(l *lua.State) (*Environment, error)

func (*Environment) Init

func (e *Environment) Init() (*lua.State, error)

type FileInfo

type FileInfo struct {
	Name         string
	SelfUrl      string
	IsDir        bool
	LastModified time.Time
	Size         uint64
	ETag         string
}

type Filesystem

type Filesystem interface {
	GetReader(file string) (io.ReadCloser, error)
	GetWriter(file string) (io.WriteCloser, error)
	List(path string) ([]FileInfo, error)
	Delete(path string) error
}

type FsError

type FsError string

func (FsError) Error

func (e FsError) Error() string

type Log

type Log interface {
	WithFields(context map[string]interface{}) Log
	Debug(msg string, context map[string]interface{})
	Info(msg string, context map[string]interface{})
	Warn(msg string, context map[string]interface{})
	Error(msg string, context map[string]interface{})
	Fatal(msg string, context map[string]interface{})
}

type LuaFile

type LuaFile struct {
	Name string
	Code string
}

type VFS

type VFS struct {
	BaseFs   Filesystem
	Prefixes map[string]Filesystem
}

func (*VFS) Delete

func (vfs *VFS) Delete(file string) error

func (*VFS) GetReader

func (vfs *VFS) GetReader(file string) (io.ReadCloser, error)

func (*VFS) GetWriter

func (vfs *VFS) GetWriter(file string) (io.WriteCloser, error)

func (*VFS) List

func (vfs *VFS) List(file string) ([]FileInfo, error)

type WriteSyncer

type WriteSyncer interface {
	io.Writer
	Sync() error
}

Directories

Path Synopsis
Code generated by go generate; DO NOT EDIT.
Code generated by go generate; DO NOT EDIT.

Jump to

Keyboard shortcuts

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