Documentation
¶
Overview ¶
Package runtime is a stack-based register VM to run the bytecode for the parsed lua
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Stdin is a file wrapper around stdin so that it can easily be read from. Stdin = &File{ handle: os.Stdin, reader: bufio.NewReader(os.Stdin), Path: "<stdin>", readOnly: true, isstdpipe: true, } // Stdout is a file wrapper around stdout so that it can easily be written to. Stdout = &File{ handle: os.Stdout, Path: "<stdout>", writeOnly: true, isstdpipe: true, } // Stderr is a file wrapper around stderr to easily write to. Stderr = &File{ handle: os.Stderr, Path: "<stderr>", writeOnly: true, isstdpipe: true, } )
var ( // WarnEnabled is the flag that will toggle warn messages, it can be toggled with the Warn() function. WarnEnabled = false )
Functions ¶
func PopenCommand ¶
PopenCommand creates a platform independent exec.Cmd.
Types ¶
type Closure ¶
type Closure struct {
// contains filtered or unexported fields
}
Closure is a lua function encapsulated in the vm.
type File ¶
File is a lua file handle.
func CreateTmpFile ¶
CreateTmpFile will create a temporary file.
func POpen ¶
POpen will create a new command and executes it with a filewrapper around it, which makes it easy to read and write from.
type GoFunc ¶
type GoFunc struct {
// contains filtered or unexported fields
}
GoFunc is a go func usable by the vm.
type Interrupt ¶
type Interrupt struct {
// contains filtered or unexported fields
}
Interrupt is an error type that allows the VM to react to the kind. For instance debug, yield, or exit.
type InterruptKind ¶
type InterruptKind int
InterruptKind distinguishes Interrupts to change the behaviour when an Interrupt was returned from a function call.
const ( // InterruptExit will interrupt the vm and exit the entire application. InterruptExit InterruptKind = iota // InterruptYield is only allowed in coroutines and will yield the coroutine to the parent. InterruptYield // InterruptDebug will interrupt the vm and start a repl in the context where debug was called. InterruptDebug )
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table is a container object in lua that acts both as an array and a map It is used duing runtime but cal also be changed in go code.
func NewTable ¶
NewTable will create a new table with default values contained in it. Since lua tables act as both array and map, both can be passed in to set the values.
func (*Table) Get ¶
Get will return the value for the key. If it is an int it will get it from the array store, otherwise the map. Nil keys are not allowed.
type Thread ¶
type Thread struct {
// contains filtered or unexported fields
}
Thread is a lua coroutine.
type VM ¶
type VM struct {
Stack []any
// contains filtered or unexported fields
}
VM is the interpreter runtime that does everything in memory.
func New ¶
New will create a new vm for evaluating. It will establish the initial stack, setup the environment and globals, and make any extra arguments provided available as the arg value in luaf.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package pack allows for serialization and deserialization of data into a string.
|
Package pack allows for serialization and deserialization of data into a string. |
|
Package pattern is the package that implements lua patterns.
|
Package pattern is the package that implements lua patterns. |