runtime

package
v0.0.0-...-e0b5347 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2023 License: Apache-2.0 Imports: 24 Imported by: 4

Documentation

Index

Constants

View Source
const ConstTypeMaj = CodeType + 1

ConstTypeMaj Constant types must be less that this.

View Source
const (
	MetaFieldGcString = "__gc"
)
View Source
const QuotasAvailable = true

Variables

View Source
var ErrInvalidMarshalPrefix = errors.New("Invalid marshal prefix")
View Source
var (
	MetaFieldGcValue = StringValue(MetaFieldGcString)
)
View Source
var NilValue = Value{}

NilValue is a value holding Nil.

Functions

func BinaryArithmeticError

func BinaryArithmeticError(op string, x, y Value) error

BinaryArithmeticError returns an error describing the problem with trying to perform x op y.

func Call

func Call(t *Thread, f Value, args []Value, next Cont) error

Call calls f with arguments args, pushing the results on next. It may use the metamethod '__call' if f is not callable.

func ErrorIsUnexpectedEOF

func ErrorIsUnexpectedEOF(err error) bool

func HasMarshalPrefix

func HasMarshalPrefix(bs []byte) bool

HasMarshalPrefix returns true if the byte slice passed starts witht the magic prefix for Lua marshalled values.

func IntLen

func IntLen(t *Thread, v Value) (int64, error)

IntLen returns the length of v as an int64, possibly calling the '__len' metamethod. This is an optimization of Len for an integer output.

func Lt

func Lt(t *Thread, x, y Value) (bool, error)

Lt returns whether x < y is true (and an error if it's not possible to compare them).

func MarshalConst

func MarshalConst(w io.Writer, c Value, budget uint64) (used uint64, err error)

MarshalConst serializes a const value to the writer w.

func Metacall

func Metacall(t *Thread, obj Value, method string, args []Value, next Cont) (error, bool)

Metacall calls the metamethod called method on obj with the given arguments args, pushing the result to the continuation next.

func RawEqual

func RawEqual(x, y Value) (bool, bool)

RawEqual returns two values. The second one is true if raw equality makes sense for x and y. The first one returns whether x and y are raw equal.

func SetIndex

func SetIndex(t *Thread, coll Value, idx Value, val Value) error

SetIndex sets the item in a collection for the given key, using the '__newindex' metamethod if appropriate. SetIndex always consumes CPU if it doesn't return an error.

func SolemnlyDeclareCompliance

func SolemnlyDeclareCompliance(flags ComplianceFlags, fs ...*GoFunction)

SolemnlyDeclareCompliance is a convenience function that adds the same set of compliance flags to a number of functions. See quotas.md for details about compliance flags.

func ToFloat

func ToFloat(v Value) (float64, bool)

ToFloat returns v as a FLoat and true if v is a valid float.

func ToInt

func ToInt(v Value) (int64, bool)

ToInt returns v as an Int and true if v is actually a valid integer.

func ToIntNoString

func ToIntNoString(v Value) (int64, bool)

ToIntNoString returns v as an Int and true if v is actually a valid integer.

func ToNumberValue

func ToNumberValue(v Value) (Value, NumberType)

ToNumberValue returns the Value v as a Float or Int, and if it is a number. If it is not a number, it returns v unchanged and NaN.

func Truth

func Truth(v Value) bool

Truth returns true if v is neither nil nor a false boolean.

func UnaryArithmeticError

func UnaryArithmeticError(op string, x Value) error

UnaryArithmeticError returns an error describing the problem with trying to perform the unary operation op(x).

Types

type Callable

type Callable interface {
	Continuation(*Thread, Cont) Cont
}

Callable is the interface for callable values.

type Cell

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

Cell is the data structure that represents a reference to a value. Whenever a value is put into a register that contains a cell, it is put in the cell rather than the register itself. It is used in order to implement upvalues in lua. Example:

local x
local function f() return x + 1 end
x = 3
f()

The variable x is an upvalue in f so when x is set to 3 the upvalue of f must be set to 3. This is achieved by setting the register that contains x to a Cell.

type Closure

type Closure struct {
	*Code
	Upvalues []Cell
	// contains filtered or unexported fields
}

Closure is the data structure that represents a Lua function. It is simply a reference to a Code instance and a set of upvalues.

func NewClosure

func NewClosure(r *Runtime, c *Code) *Closure

NewClosure returns a pointer to a new Closure instance for the given code.

func (*Closure) AddUpvalue

func (c *Closure) AddUpvalue(cell Cell)

AddUpvalue append a new upvalue to the closure.

func (*Closure) Continuation

func (c *Closure) Continuation(t *Thread, next Cont) Cont

Continuation implements Callable.Continuation.

func (*Closure) Equals

func (c *Closure) Equals(c1 *Closure) bool

Equals returns a true if it can assert that c and c1 implement the same function.

func (*Closure) GetUpvalue

func (c *Closure) GetUpvalue(n int) Value

GetUpvalue returns the upvalue for c at index n.

func (*Closure) SetUpvalue

func (c *Closure) SetUpvalue(n int, val Value)

SetUpvalue sets the upvalue for c at index n to v.

type Code

type Code struct {
	UpvalueCount int16
	UpNames      []string
	RegCount     int16
	CellCount    int16
	// contains filtered or unexported fields
}

Code represents the code for a Lua function together with all the constants that this function uses. It can be turned into a closure by adding upvalues.

type ComplianceFlags

type ComplianceFlags uint16

ComplianceFlags represents constraints that the code running must comply with.

const (
	// Only execute code checks memory availability before allocating memory
	ComplyMemSafe ComplianceFlags = 1 << iota

	// Only execute code that checks cpu availability before executing a
	// computation.
	ComplyCpuSafe

	// Only execute code that complies with IO restrictions (currently only
	// functions that do no IO comply with this)
	ComplyIoSafe

	// Only execute code that is time safe (i.e. it will not block on long
	// running ops, typically IO)
	ComplyTimeSafe
)

func (ComplianceFlags) AddFlagWithName

func (f ComplianceFlags) AddFlagWithName(name string) (ComplianceFlags, bool)

func (ComplianceFlags) Names

func (f ComplianceFlags) Names() (names []string)

type Cont

type Cont interface {

	// Push "pushes" a Value to the continuation (arguments before a call, or
	// before resuming a continuation which has been suspended via "yield").  This is to
	// pass arguments to the continuation before calling RunInThread.
	Push(*Runtime, Value)

	// PushEtc "pushes" varargs to the continutation, this happens e.g. in Lua
	// code when running "f(...)".
	PushEtc(*Runtime, []Value)

	// RunInThread runs the continuation in the given thread, returning either
	// the next continuation to be run or an error.
	RunInThread(*Thread) (Cont, error)

	// Next() returns the continuation that follows after this one (could be
	// e.g. the caller).
	Next() Cont

	// Parent() returns the continuation that initiated this continuation.  It
	// can be the same as Next() but not necessarily.  This is useful for giving
	// meaningful tracebacks, not used by the runtime engine.
	Parent() Cont

	// DebugInfo() returns debug info for the continuation.  Used for building
	// error messages and tracebacks.
	DebugInfo() *DebugInfo
}

Cont is an interface for things that can be run in a Thread. Implementations of Cont a typically an invocation of a Lua function or an invocation of a Go function.

func Continue

func Continue(t *Thread, f Value, next Cont) (Cont, error)

Continue tries to continue the value f or else use its '__call' metamethod and returns the continuations that needs to be run to get the results.

type ContextTerminationError

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

A ContextTerminationError is an error reserved for when the runtime context should be terminated immediately.

func (ContextTerminationError) Error

func (e ContextTerminationError) Error() string

Error string for a ContextTerminationError

type DebugHookFlags

type DebugHookFlags uint8

DebugHookFlags is the type of representing a set of debug hooks.

const (
	HookFlagCall   DebugHookFlags // call hook
	HookFlagReturn                // return hook
	HookFlagLine                  // line hook
	HookFlagCount                 // count hook
)

type DebugHooks

type DebugHooks struct {
	DebugHookFlags DebugHookFlags // hooks enabled
	HookLineCount  int            // number of lines for count hook
	Hook           Value          // The hook callback
}

DebugHooks contains data specifying a debug hooks configuration.

func (*DebugHooks) SetupHooks

func (h *DebugHooks) SetupHooks(newHooks DebugHooks)

SetupHooks configures the debug hooks to use. It does nothing if we are in a hook callback.

type DebugInfo

type DebugInfo struct {
	Source      string
	Name        string
	CurrentLine int32
}

DebugInfo contains info about a continuation that can be looked at for debugging purposes (and tracebacks).

func (DebugInfo) String

func (i DebugInfo) String() string

String formats the data contained in DebugInfo in a human-readable way.

type Error

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

Error is the error type that can be produced by running continuations. Each error has a message and a context, which is a slice of continuations. There is no call stack, but you can imagine you "unwind" the call stack by iterating over this slice.

func AsError

func AsError(err error) (rtErr *Error, ok bool)

AsError check if err can be converted to an *Error and returns that if successful.

func NewError

func NewError(message Value) *Error

NewError returns a new error with the given message and no context.

func ToError

func ToError(err error) *Error

ToError turns err into an *Error instance.

func (*Error) AddContext

func (e *Error) AddContext(c Cont, depth int) *Error

AddContext returns a new error with the lineno / source fields set if not already set.

func (*Error) Error

func (e *Error) Error() string

Error implements the error interface.

func (*Error) Handled

func (e *Error) Handled() bool

Handled returns true if the error has been handled (i.e. the message handler has processed it).

func (*Error) Value

func (e *Error) Value() Value

Value returns the message of the error (which can be any Lua Value).

type GCPolicy

type GCPolicy int16
const (
	DefaultGCPolicy GCPolicy = iota
	ShareGCPolicy
	IsolateGCPolicy
	UnknownGCPolicy
)

type GoCont

type GoCont struct {
	*GoFunction
	// contains filtered or unexported fields
}

GoCont implements Cont for functions written in Go.

func NewGoCont

func NewGoCont(t *Thread, f *GoFunction, next Cont) *GoCont

NewGoCont returns a new pointer to GoCont for the given GoFunction and Cont.

func (*GoCont) Arg

func (c *GoCont) Arg(n int) Value

Arg returns the n-th arg of the continuation. It doesn't do any range check!

func (*GoCont) Args

func (c *GoCont) Args() []Value

Args returns the slice of args pushed to the continuation.

func (*GoCont) BoolArg

func (c *GoCont) BoolArg(n int) (bool, error)

BoolArg returns the n-th argument as a string if possible, otherwise a non-nil error. No range check!

func (*GoCont) CallableArg

func (c *GoCont) CallableArg(n int) (Callable, error)

CallableArg returns the n-th argument as a callable if possible, otherwise a non-nil error. No range check!

func (*GoCont) Check1Arg

func (c *GoCont) Check1Arg() error

Check1Arg returns a non-nil error if the continuation doesn't have at least one arg.

func (*GoCont) CheckNArgs

func (c *GoCont) CheckNArgs(n int) error

CheckNArgs returns a non-nil error if the continuation doesn't have at least n args.

func (*GoCont) ClosureArg

func (c *GoCont) ClosureArg(n int) (*Closure, error)

ClosureArg returns the n-th argument as a closure if possible, otherwise a non-nil error. No range check!

func (*GoCont) DebugInfo

func (c *GoCont) DebugInfo() *DebugInfo

DebugInfo returns c's debug info.

func (*GoCont) Etc

func (c *GoCont) Etc() []Value

Etc returns the etc args pushed to the continuation they exist.

func (*GoCont) FloatArg

func (c *GoCont) FloatArg(n int) (float64, error)

FloatArg returns the n-th argument as a Float if possible, otherwise a non-nil error. No range check!

func (*GoCont) IntArg

func (c *GoCont) IntArg(n int) (int64, error)

IntArg returns the n-th argument as an Int if possible, otherwise a non-nil error. No range check!

func (*GoCont) NArgs

func (c *GoCont) NArgs() int

NArgs returns the number of args pushed to the continuation.

func (*GoCont) Next

func (c *GoCont) Next() Cont

Next returns the next continuation.

func (*GoCont) Parent

func (c *GoCont) Parent() Cont

Parent returns the continuation's parent.

func (*GoCont) Push

func (c *GoCont) Push(r *Runtime, v Value)

Push implements Cont.Push.

func (*GoCont) PushEtc

func (c *GoCont) PushEtc(r *Runtime, etc []Value)

PushEtc pushes a slice of values to the continutation.

func (*GoCont) PushingNext

func (c *GoCont) PushingNext(r *Runtime, vals ...Value) Cont

PushingNext is convenient when implementing go functions. It pushes the given values to c.Next() and returns it.

func (*GoCont) PushingNext1

func (c *GoCont) PushingNext1(r *Runtime, val Value) Cont

PushingNext1 is convenient when implementing go functions. It pushes the given value to c.Next() and returns it.

func (*GoCont) RunInThread

func (c *GoCont) RunInThread(t *Thread) (next Cont, err error)

RunInThread implements Cont.RunInThread.

func (*GoCont) StringArg

func (c *GoCont) StringArg(n int) (string, error)

StringArg returns the n-th argument as a string if possible, otherwise a non-nil error. No range check!

func (*GoCont) TableArg

func (c *GoCont) TableArg(n int) (*Table, error)

TableArg returns the n-th argument as a table if possible, otherwise a non-nil error. No range check!

func (*GoCont) ThreadArg

func (c *GoCont) ThreadArg(n int) (*Thread, error)

ThreadArg returns the n-th argument as a thread if possible, otherwise a non-nil error. No range check!

func (*GoCont) UserDataArg

func (c *GoCont) UserDataArg(n int) (*UserData, error)

UserDataArg returns the n-th argument as a UserData if possible, otherwise a non-nil error. No range check!

type GoFunction

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

A GoFunction is a callable value implemented by a native Go function.

func NewGoFunction

func NewGoFunction(f GoFunctionFunc, name string, nArgs int, hasEtc bool) *GoFunction

NewGoFunction returns a new GoFunction.

func (*GoFunction) Continuation

func (f *GoFunction) Continuation(t *Thread, next Cont) Cont

Continuation implements Callable.Continuation.

func (*GoFunction) SolemnlyDeclareCompliance

func (f *GoFunction) SolemnlyDeclareCompliance(flags ComplianceFlags)

SolemnlyDeclareCompliance adds compliance flags to f. See quotas.md for details about compliance flags.

type GoFunctionFunc

type GoFunctionFunc func(*Thread, *GoCont) (Cont, error)

type LightUserData

type LightUserData struct {
	Data interface{}
}

A LightUserData is some Go value of unspecified type wrapped to be used as a lua Value.

type LogWarner

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

The default Warner type. It logs messages to a given io.Writer. Note that it is off by default. Issue Warn("@on") to turn it on.

func NewLogWarner

func NewLogWarner(dest io.Writer, pfx string) *LogWarner

NewLogWarner returns a new LogWarner that will write to dest with the given prefix.

func (*LogWarner) Warn

func (w *LogWarner) Warn(msgs ...string)

Warn concatenates its arguments and emits a warning message (written to dest). It understands two control messages: "@on" and "@off", with the obvious meaning.

type LuaCont

type LuaCont struct {
	*Closure
	// contains filtered or unexported fields
}

LuaCont is a Lua continuation, made from a closure, values for registers and some state.

func NewLuaCont

func NewLuaCont(t *Thread, clos *Closure, next Cont) *LuaCont

NewLuaCont returns a new LuaCont from a closure and next, a continuation to push results into.

func (*LuaCont) DebugInfo

func (c *LuaCont) DebugInfo() *DebugInfo

DebugInfo implements Cont.DebugInfo.

func (*LuaCont) Next

func (c *LuaCont) Next() Cont

Next implements Cont.Next.

func (*LuaCont) Parent

func (c *LuaCont) Parent() Cont

func (*LuaCont) Push

func (c *LuaCont) Push(r *Runtime, val Value)

Push implements Cont.Push.

func (*LuaCont) PushEtc

func (c *LuaCont) PushEtc(r *Runtime, vals []Value)

PushEtc implements Cont.PushEtc. TODO: optimise.

func (*LuaCont) RunInThread

func (c *LuaCont) RunInThread(t *Thread) (Cont, error)

RunInThread implements Cont.RunInThread.

type Metatabler

type Metatabler interface {
	Metatable() *Table
}

type NumberType

type NumberType uint16

NumberType represents a type of number

const (
	// IsFloat is the type of Floats
	IsFloat NumberType = 1 << iota
	// IsInt is the type of Ints
	IsInt
	// NaN is the type of values which are not numbers
	NaN
	// NaI is a type for values which a not Ints
	NaI
)

func FloatToInt

func FloatToInt(f float64) (int64, NumberType)

FloatToInt turns a float64 into an int64 if possible.

func StringToNumber

func StringToNumber(s string) (n int64, f float64, tp NumberType)

func ToNumber

func ToNumber(v Value) (int64, float64, NumberType)

ToNumber returns x as a Float or Int, and the type (IsFloat, IsInt or NaN).

type ResourceReleaser

type ResourceReleaser interface {
	ReleaseResources()
}

type Runtime

type Runtime struct {
	Stdout io.Writer // This is useful for testing / repls
	// contains filtered or unexported fields
}

A Runtime is a Lua runtime. It contains all the global state of the runtime (in particular a reference to the global environment and the main thread).

func New

func New(stdout io.Writer, opts ...RuntimeOption) *Runtime

New returns a new pointer to a Runtime with the given stdout.

func (*Runtime) CheckRequiredFlags

func (m *Runtime) CheckRequiredFlags(flags ComplianceFlags) error

func (*Runtime) Close

func (r *Runtime) Close(err *error)

func (*Runtime) CompileAndLoadLuaChunk

func (r *Runtime) CompileAndLoadLuaChunk(name string, source []byte, env Value, scannerOptions ...scanner.Option) (*Closure, error)

CompileAndLoadLuaChunk parses, compiles and loads a Lua chunk from source and returns the closure that runs the chunk in the given global environment.

func (*Runtime) CompileAndLoadLuaChunkOrExp

func (r *Runtime) CompileAndLoadLuaChunkOrExp(name string, source []byte, env Value, scannerOptions ...scanner.Option) (*Closure, error)

CompileAndLoadLuaChunk parses, compiles and loads a Lua chunk from source and returns the closure that runs the chunk in the given global environment.

func (*Runtime) CompileLuaChunk

func (r *Runtime) CompileLuaChunk(name string, source []byte, scannerOptions ...scanner.Option) (*code.Unit, uint64, error)

CompileLuaChunk parses and compiles the source as a Lua Chunk and returns the compile code Unit.

func (*Runtime) CompileLuaChunkOrExp

func (r *Runtime) CompileLuaChunkOrExp(name string, source []byte, scannerOptions ...scanner.Option) (unit *code.Unit, sz uint64, err error)

func (*Runtime) Due

func (m *Runtime) Due() bool

func (*Runtime) GCPolicy

func (m *Runtime) GCPolicy() GCPolicy

func (*Runtime) GlobalEnv

func (r *Runtime) GlobalEnv() *Table

GlobalEnv returns the global environment of the runtime.

func (*Runtime) HardLimits

func (m *Runtime) HardLimits() RuntimeResources

func (*Runtime) KillContext

func (m *Runtime) KillContext()

KillContext forcefully terminates the context with the message "force kill".

func (*Runtime) LinearRequire

func (m *Runtime) LinearRequire(cpuFactor uint64, amt uint64)

LinearRequire can be used to actually consume (part of) the resource budget returned by LinearUnused (with the same cpuFactor).

func (*Runtime) LinearUnused

func (m *Runtime) LinearUnused(cpuFactor uint64) uint64

LinearUnused returns an amount of resource combining memory and cpu. It is useful when calling functions whose time complexity is a linear function of the size of their output. As cpu ticks are "smaller" than memory ticks, the cpuFactor arguments allows specifying an increased "weight" for cpu ticks.

func (*Runtime) LoadFromSourceOrCode

func (r *Runtime) LoadFromSourceOrCode(name string, source []byte, mode string, env Value, stripComment bool) (*Closure, error)

LoadFromSourceOrCode loads the given source, compiling it if it is source code or unmarshaling it if it is dumped code. It returns the closure that runs the chunk in the given global environment.

func (*Runtime) LoadLuaUnit

func (r *Runtime) LoadLuaUnit(unit *code.Unit, env Value) *Closure

LoadLuaUnit turns a code unit into a closure given an environment env.

func (*Runtime) MainThread

func (r *Runtime) MainThread() *Thread

MainThread returns the runtime's main thread.

func (*Runtime) Metatable

func (r *Runtime) Metatable(v Value) Value

Metatable returns the metatalbe of v (looking for '__metatable' in the raw metatable).

func (*Runtime) NewUserDataValue

func (r *Runtime) NewUserDataValue(iface interface{}, meta *Table) Value

NewUserDataValue creates a Value containing the user data with the given Go value and metatable. It also registers a GC finalizer if the metadata has a __gc field.

func (*Runtime) Parent

func (m *Runtime) Parent() RuntimeContext

func (*Runtime) ParseLuaChunk

func (r *Runtime) ParseLuaChunk(name string, source []byte, scannerOptions ...scanner.Option) (stat *ast.BlockStat, statSize uint64, err error)

ParseLuaChunk parses a string as a Lua statement and returns the AST.

func (*Runtime) ParseLuaExp

func (r *Runtime) ParseLuaExp(name string, source []byte, scannerOptions ...scanner.Option) (stat *ast.BlockStat, statSize uint64, err error)

ParseLuaExp parses a string as a Lua expression and returns the AST.

func (*Runtime) PopContext

func (m *Runtime) PopContext() RuntimeContext

func (*Runtime) ProcessIoError

func (r *Runtime) ProcessIoError(c Cont, ioErr error) (Cont, error)

ProcessIoError is like PushIoError but its signature makes it convenient to use in a return statement from a GoFunc implementation.

func (*Runtime) Push

func (r *Runtime) Push(c Cont, vals ...Value)

Push is a convenience method that pushes a number of values to the continuation c.

func (*Runtime) Push1

func (r *Runtime) Push1(c Cont, v Value)

Push1 is a convenience method that pushes v to the continuation c.

func (*Runtime) PushContext

func (m *Runtime) PushContext(ctx RuntimeContextDef)

func (*Runtime) PushIoError

func (r *Runtime) PushIoError(c Cont, ioErr error) error

PushIoError is a convenience method that translates ioErr to a value if appropriated and pushes that value to c, else returns an error. It is useful because a number of Go IO errors are considered regular return values by Lua.

func (*Runtime) RawMetatable

func (r *Runtime) RawMetatable(v Value) *Table

RawMetatable returns the raw metatable for a value (that is, not looking at the metatable's '__metatable' key).

func (*Runtime) RefactorCodeConsts

func (r *Runtime) RefactorCodeConsts(c *Code) *Code

RefactorConsts returns an equivalent *Code this consts "refactored", which means that the consts are slimmed down to only contains the constants required for the function.

func (*Runtime) Registry

func (r *Runtime) Registry(key Value) Value

Registry returns the Value associated with key in the runtime's registry.

func (*Runtime) ReleaseArrSize

func (m *Runtime) ReleaseArrSize(sz uintptr, n int)

func (*Runtime) ReleaseBytes

func (m *Runtime) ReleaseBytes(n int)

func (*Runtime) ReleaseMem

func (m *Runtime) ReleaseMem(memAmount uint64)

func (*Runtime) ReleaseSize

func (m *Runtime) ReleaseSize(sz uintptr)

func (*Runtime) RequireArrSize

func (m *Runtime) RequireArrSize(sz uintptr, n int) (mem uint64)

func (*Runtime) RequireBytes

func (m *Runtime) RequireBytes(n int) (mem uint64)

func (*Runtime) RequireCPU

func (m *Runtime) RequireCPU(cpuAmount uint64)

func (*Runtime) RequireMem

func (m *Runtime) RequireMem(memAmount uint64)

func (*Runtime) RequireSize

func (m *Runtime) RequireSize(sz uintptr) (mem uint64)

func (*Runtime) RequiredFlags

func (m *Runtime) RequiredFlags() ComplianceFlags

func (*Runtime) RuntimeContext

func (m *Runtime) RuntimeContext() RuntimeContext

func (*Runtime) SetEnv

func (r *Runtime) SetEnv(t *Table, name string, v Value)

SetEnv sets the item in the table t for a string key. Useful when writing libraries

func (*Runtime) SetEnvGoFunc

func (r *Runtime) SetEnvGoFunc(t *Table, name string, f GoFunctionFunc, nArgs int, hasEtc bool) *GoFunction

SetEnvGoFunc sets the item in the table t for a string key to be a GoFunction defined by f. Useful when writing libraries

func (*Runtime) SetRawMetatable

func (r *Runtime) SetRawMetatable(v Value, meta *Table)

SetRawMetatable sets the metatable for value v to meta.

func (*Runtime) SetRegistry

func (r *Runtime) SetRegistry(k, v Value)

SetRegistry sets the value associated with the key k to v in the registry.

func (*Runtime) SetStopLevel

func (m *Runtime) SetStopLevel(stopLevel StopLevel)

func (*Runtime) SetStringMeta

func (r *Runtime) SetStringMeta(meta *Table)

SetStringMeta sets the runtime's string metatable (all strings in a runtime have the same metatable).

func (*Runtime) SetTable

func (r *Runtime) SetTable(t *Table, k, v Value)

Set a value in a table, requiring memory if needed, and always consuming >0 CPU.

func (*Runtime) SetTableCheck

func (r *Runtime) SetTableCheck(t *Table, k, v Value) error

SetTableCheck sets k => v in table T if possible, returning an error if k is nil or NaN.

func (*Runtime) SetWarner

func (r *Runtime) SetWarner(warner Warner)

SetWarner replaces the current warner (Lua 5.4)

func (*Runtime) SoftLimits

func (m *Runtime) SoftLimits() RuntimeResources

func (*Runtime) Status

func (m *Runtime) Status() RuntimeContextStatus

func (*Runtime) TerminateContext

func (m *Runtime) TerminateContext(format string, args ...interface{})

TerminateContext forcefully terminates the context with the given message.

func (*Runtime) Traceback

func (r *Runtime) Traceback(pfx string, c Cont) string

Traceback produces a traceback string of the continuation, requiring memory for the string.

func (*Runtime) UnusedCPU

func (m *Runtime) UnusedCPU() uint64

func (*Runtime) UnusedMem

func (m *Runtime) UnusedMem() uint64

func (*Runtime) UsedResources

func (m *Runtime) UsedResources() RuntimeResources

func (*Runtime) Warn

func (r *Runtime) Warn(msgs ...string)

Warn emits a warning with the given message (Lua 5.4). The default warner is off to start with. It can be switch on / off by sending it a message "@on" / "@off".

type RuntimeContext

type RuntimeContext interface {
	HardLimits() RuntimeResources
	SoftLimits() RuntimeResources
	UsedResources() RuntimeResources

	Status() RuntimeContextStatus
	Parent() RuntimeContext

	RequiredFlags() ComplianceFlags

	SetStopLevel(StopLevel)
	Due() bool

	GCPolicy() GCPolicy
}

RuntimeContext is an interface implemented by Runtime.RuntimeContext(). It provides a public interface for the runtime context to be used by e.g. libraries (e.g. the runtime package).

func DoInContext

func DoInContext(f func(r *Runtime) error, def RuntimeContextDef, stdout io.Writer, opts ...RuntimeOption) (ctx RuntimeContext, err error)

DoInContext creates a *Runtime r with the constraints from the RuntimeContextDef def, calls f(r) and returns two things: A RuntimeContext instance ctx whose status tells us the outcome (done, killed or error) and in case of error, a non-nil error value.

type RuntimeContextDef

type RuntimeContextDef struct {
	HardLimits     RuntimeResources
	SoftLimits     RuntimeResources
	RequiredFlags  ComplianceFlags
	MessageHandler Callable
	GCPolicy
}

RuntimeContextDef contains the data necessary to create an new runtime context.

type RuntimeContextStatus

type RuntimeContextStatus uint16

RuntimeContextStatus describes the status of a context

const (
	StatusLive   RuntimeContextStatus = iota // currently executing
	StatusDone                               // finished successfully (no error)
	StatusError                              // finished with a Lua error
	StatusKilled                             // terminated (either by user or because hard limits were reached)
)

func (RuntimeContextStatus) String

func (s RuntimeContextStatus) String() string

type RuntimeOption

type RuntimeOption func(*runtimeOptions)

A RuntimeOption configures the Runtime.

func WithRegPoolSize

func WithRegPoolSize(sz uint) RuntimeOption

WithRegPoolSize set the size of register pool when creating a new Runtime. The default register pool size is 10.

func WithRegSetMaxAge

func WithRegSetMaxAge(age uint) RuntimeOption

WithRegSetMaxAge sets the max age of a register set when creating a new Runtime. The default max age is 10.

func WithRuntimeContext

func WithRuntimeContext(def RuntimeContextDef) RuntimeOption

type RuntimeResources

type RuntimeResources struct {
	Cpu    uint64
	Memory uint64
	Millis uint64
}

RuntimeResources describe amount of resources that code can consume. Depending on the context, it could be available resources or consumed resources. For available resources, 0 means unlimited.

func (RuntimeResources) Dominates

func (r RuntimeResources) Dominates(v RuntimeResources) bool

Dominates returns true if the resource count v doesn't reach the resource limit r.

func (RuntimeResources) Merge

Merge treats the receiver and argument as describing resource limits and returns the resources describing the intersection of those limits.

func (RuntimeResources) Remove

Remove lowers the resources accounted for in the receiver by the resources accounted for in the argument.

type StopLevel

type StopLevel uint8
const (
	SoftStop StopLevel = 1 << iota // Forces the context to be due
	HardStop                       // Forces the context to terminate
)

type SyntaxError

type SyntaxError struct {
	File string
	Err  parsing.Error
}

A SyntaxError is a lua syntax error.

func AsSyntaxError

func AsSyntaxError(err error) (snErr *SyntaxError, ok bool)

func NewSyntaxError

func NewSyntaxError(file string, err parsing.Error) *SyntaxError

NewSyntaxError returns a pointer to a SyntaxError for the error err in file.

func (*SyntaxError) Error

func (e *SyntaxError) Error() string

Error implements the error interface.

func (*SyntaxError) IsUnexpectedEOF

func (e *SyntaxError) IsUnexpectedEOF() bool

IsUnexpectedEOF returns true if the error signals that EOF was encountered when further tokens were required.

type Table

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

Table implements a Lua table.

func NewTable

func NewTable() *Table

NewTable returns a new Table.

func (*Table) Clone

func (t *Table) Clone() luagc.Value

func (*Table) Get

func (t *Table) Get(k Value) Value

Get returns t[k].

func (*Table) Key

func (t *Table) Key() luagc.Key

func (*Table) Len

func (t *Table) Len() int64

Len returns a length for t (see lua docs for details).

func (*Table) Metatable

func (t *Table) Metatable() *Table

Metatable returns the table's metatable.

func (*Table) Next

func (t *Table) Next(k Value) (next Value, val Value, ok bool)

Next returns the key-value pair that comes after k in the table t.

func (*Table) Reset

func (t *Table) Reset(k, v Value) (wasSet bool)

Reset implements t[k] = v only if t[k] was already non-nil.

func (*Table) Set

func (t *Table) Set(k, v Value) uint64

Set implements t[k] = v (doesn't check if k is nil).

func (*Table) SetMetatable

func (t *Table) SetMetatable(m *Table)

SetMetatable sets the table's metatable.

type Termination

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

Termination is a 'dead-end' continuation: it cannot be run.

func NewTermination

func NewTermination(parent Cont, args []Value, etc *[]Value) *Termination

NewTermination returns a new pointer to Termination where the first len(args) values will be pushed into args and the remaining ones will be added to etc if it is non nil, dropped otherwise.

func NewTerminationWith

func NewTerminationWith(parent Cont, nArgs int, hasEtc bool) *Termination

NewTerminationWith creates a new Termination expecting nArgs args and possibly gathering extra args into an etc if hasEtc is true.

func (*Termination) DebugInfo

func (c *Termination) DebugInfo() *DebugInfo

DebugInfo implements Cont.DebugInfo.

func (*Termination) Etc

func (c *Termination) Etc() []Value

Etc returns all the extra args pushed to the termination.

func (*Termination) Get

func (c *Termination) Get(n int) Value

Get returns the n-th arg pushed to the termination.

func (*Termination) Next

func (c *Termination) Next() Cont

Next implmements Cont.Next.

func (*Termination) Parent

func (c *Termination) Parent() Cont

func (*Termination) Push

func (c *Termination) Push(r *Runtime, v Value)

Push implements Cont.Push. It just accumulates values into a slice.

func (*Termination) PushEtc

func (c *Termination) PushEtc(r *Runtime, etc []Value)

PushEtc implements Cont.PushEtc.

func (*Termination) Reset

func (c *Termination) Reset()

Reset erases all the args pushed to the termination.

func (*Termination) RunInThread

func (c *Termination) RunInThread(t *Thread) (Cont, error)

RunInThread implements Cont.RunInThread. A termination exits immediately so it always returns nil.

type Thread

type Thread struct {
	*Runtime

	DebugHooks
	// contains filtered or unexported fields
}

A Thread is a lua thread.

The mutex guarantees that if status == ThreadRunning, then caller is not nil.

func NewThread

func NewThread(r *Runtime) *Thread

NewThread creates a new thread out of a Runtime. Its initial status is suspended. Call Resume to run it.

func (*Thread) CallContext

func (t *Thread) CallContext(def RuntimeContextDef, f func() error) (ctx RuntimeContext, err error)

CallContext pushes a new runtime context on the thread's runtime and attempts to run f() in the thread. If the context runs out of resources while f() is running, all operations should abort and the CallContext should return immediately and not finalizing pending to-be-closed values.

Otherwise (even if f() returns an error), pending to-be-closed values should be finalized.

See quotas.md for details about this API.

func (Thread) CheckRequiredFlags

func (m Thread) CheckRequiredFlags(flags ComplianceFlags) error

func (*Thread) Close

func (t *Thread) Close(caller *Thread) (bool, error)

Close a suspended thread. If successful, its status switches to dead. The boolean returned is true if it was possible to close the thread (i.e. it was suspended or already dead). The error is non-nil if there was an error in the cleanup process, or if the thread had already stopped with an error previously.

func (*Thread) CollectGarbage

func (t *Thread) CollectGarbage()

func (*Thread) CurrentCont

func (t *Thread) CurrentCont() Cont

CurrentCont returns the continuation currently running (or suspended) in the thread.

func (Thread) Due

func (m Thread) Due() bool

func (Thread) GCPolicy

func (m Thread) GCPolicy() GCPolicy

func (Thread) HardLimits

func (m Thread) HardLimits() RuntimeResources

func (*Thread) IsMain

func (t *Thread) IsMain() bool

IsMain returns true if the thread is the runtime's main thread.

func (Thread) KillContext

func (m Thread) KillContext()

KillContext forcefully terminates the context with the message "force kill".

func (Thread) LinearRequire

func (m Thread) LinearRequire(cpuFactor uint64, amt uint64)

LinearRequire can be used to actually consume (part of) the resource budget returned by LinearUnused (with the same cpuFactor).

func (Thread) LinearUnused

func (m Thread) LinearUnused(cpuFactor uint64) uint64

LinearUnused returns an amount of resource combining memory and cpu. It is useful when calling functions whose time complexity is a linear function of the size of their output. As cpu ticks are "smaller" than memory ticks, the cpuFactor arguments allows specifying an increased "weight" for cpu ticks.

func (Thread) Parent

func (m Thread) Parent() RuntimeContext

func (Thread) PopContext

func (m Thread) PopContext() RuntimeContext

func (Thread) PushContext

func (m Thread) PushContext(ctx RuntimeContextDef)

func (Thread) ReleaseArrSize

func (m Thread) ReleaseArrSize(sz uintptr, n int)

func (Thread) ReleaseBytes

func (m Thread) ReleaseBytes(n int)

func (Thread) ReleaseMem

func (m Thread) ReleaseMem(memAmount uint64)

func (Thread) ReleaseSize

func (m Thread) ReleaseSize(sz uintptr)

func (Thread) RequireArrSize

func (m Thread) RequireArrSize(sz uintptr, n int) (mem uint64)

func (Thread) RequireBytes

func (m Thread) RequireBytes(n int) (mem uint64)

func (Thread) RequireCPU

func (m Thread) RequireCPU(cpuAmount uint64)

func (Thread) RequireMem

func (m Thread) RequireMem(memAmount uint64)

func (Thread) RequireSize

func (m Thread) RequireSize(sz uintptr) (mem uint64)

func (Thread) RequiredFlags

func (m Thread) RequiredFlags() ComplianceFlags

func (*Thread) Resume

func (t *Thread) Resume(caller *Thread, args []Value) ([]Value, error)

Resume execution of a suspended thread. Its status switches to running while its caller's status switches to suspended.

func (*Thread) RunContinuation

func (t *Thread) RunContinuation(c Cont) (err error)

RunContinuation runs the continuation c in the thread. It keeps running until the next continuation is nil or an error occurs, in which case it returns the error.

func (Thread) RuntimeContext

func (m Thread) RuntimeContext() RuntimeContext

func (Thread) SetStopLevel

func (m Thread) SetStopLevel(stopLevel StopLevel)

func (Thread) SoftLimits

func (m Thread) SoftLimits() RuntimeResources

func (*Thread) Start

func (t *Thread) Start(c Callable)

Start starts the thread in a goroutine, giving it the callable c to run. the t.Resume() method needs to be called to provide arguments to the callable.

func (*Thread) Status

func (t *Thread) Status() ThreadStatus

Status returns the status of a thread (suspended, running or dead).

func (Thread) TerminateContext

func (m Thread) TerminateContext(format string, args ...interface{})

TerminateContext forcefully terminates the context with the given message.

func (Thread) UnusedCPU

func (m Thread) UnusedCPU() uint64

func (Thread) UnusedMem

func (m Thread) UnusedMem() uint64

func (Thread) UsedResources

func (m Thread) UsedResources() RuntimeResources

func (*Thread) Yield

func (t *Thread) Yield(args []Value) ([]Value, error)

Yield to the caller thread. The yielding thread's status switches to suspended. The caller's status must be OK.

type ThreadStatus

type ThreadStatus uint

ThreadStatus is the type of a thread status

const (
	ThreadOK        ThreadStatus = 0 // Running thread
	ThreadSuspended ThreadStatus = 1 // Thread has yielded and is waiting to be resumed
	ThreadDead      ThreadStatus = 3 // Thread has finished and cannot be resumed
)

Available statuses for threads.

type UserData

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

A UserData is a Go value of any type wrapped to be used as a Lua value. It has a metatable which may allow Lua code to interact with it.

func NewUserData

func NewUserData(v interface{}, meta *Table) *UserData

NewUserData returns a new UserData pointer for the value v, giving it meta as a metatable. This does not register a GC finalizer because access to a runtime is needed for that.

func (*UserData) Clone

func (d *UserData) Clone() luagc.Value

func (*UserData) Key

func (d *UserData) Key() luagc.Key

func (*UserData) MarkFlags

func (d *UserData) MarkFlags() (flags luagc.MarkFlags)

HasFinalizer returns true if the user data has finalizing code (either via __gc metamethod or the value needs prefinalization).

func (*UserData) Metatable

func (d *UserData) Metatable() *Table

Metatable returns the userdata's metatable.

func (*UserData) ReleaseResources

func (d *UserData) ReleaseResources()

Prefinalizer runs the value's prefinalize

func (*UserData) SetMetatable

func (d *UserData) SetMetatable(m *Table)

SetMetatable sets d's metatable to m.

func (*UserData) Value

func (d *UserData) Value() interface{}

Value returns the userdata's value.

type UserDataResourceReleaser

type UserDataResourceReleaser interface {
	ReleaseResources(d *UserData)
}

type Value

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

A Value is a runtime value.

func Add

func Add(x, y Value) (Value, bool)

Add returns (z, true) where z is the value representing x+y if x and y are numbers, else (NilValue, false).

func ArrayValue

func ArrayValue(a []Value) Value

ArrayValue returns a Value holding the given arg.

func AsValue

func AsValue(i interface{}) Value

AsValue returns a Value for the passed interface. Use carefully, as it may trigger allocations (e.g. AsValue(1) will allocate as the interface holding 1 will put 1 on the heap).

func BoolValue

func BoolValue(b bool) Value

BoolValue returns a Value holding the given arg.

func Call1

func Call1(t *Thread, f Value, args ...Value) (Value, error)

Call1 is a convenience method that calls f with arguments args and returns exactly one value.

func CodeValue

func CodeValue(c *Code) Value

CodeValue returns a Value holding the given arg.

func Concat

func Concat(t *Thread, x, y Value) (Value, error)

Concat returns x .. y, possibly calling the '__concat' metamethod.

func ContValue

func ContValue(c Cont) Value

ContValue returns a Value holding the given arg.

func Div

func Div(x, y Value) (Value, bool)

Div returns (z, true) where z is the (float) value representing x/y if x and y are numbers, else (NilValue, false).

func ErrorValue

func ErrorValue(err error) Value

ErrorValue extracts a Value from err. If err is an *Error then it returns its Value(), otherwise it builds a Value from the error string.

func FloatValue

func FloatValue(f float64) Value

FloatValue returns a Value holding the given arg.

func FunctionValue

func FunctionValue(c Callable) Value

FunctionValue returns a Value holding the given arg.

func Idiv

func Idiv(x Value, y Value) (Value, bool, error)

Div returns (z, true, nil) where z is the (integer) value representing x//y if x and y are numbers and y != 0, if y == 0 it returns (NilValue, true, div_by_zero_error), else (NilValue, false, nil) if x or y is not a number.

func Index

func Index(t *Thread, coll Value, k Value) (Value, error)

Index returns the item in a collection for the given key k, using the '__index' metamethod if appropriate. Index always consumes CPU.

func IntValue

func IntValue(n int64) Value

IntValue returns a Value holding the given arg.

func Len

func Len(t *Thread, v Value) (Value, error)

Len returns the length of v, possibly calling the '__len' metamethod.

func LightUserDataValue

func LightUserDataValue(d LightUserData) Value

LightUserDataValue returns a Value holding the given arg.

func Mod

func Mod(x Value, y Value) (Value, bool, error)

Mod returns (z, true, nil) where z is the (integer or float) value representing x%y if x and y are numbers and y != 0, if y == 0 it returns (NilValue, true, mod_by_zero_error), else (NilValue, false, nil) if x or y is not a number.

func Mul

func Mul(x, y Value) (Value, bool)

Mul returns (z, true) where z is the value representing x*y if x and y are numbers, else (NilValue, false).

func Pow

func Pow(x, y Value) (Value, bool)

Pow returns (z, true) where z is the (float) value representing x^y if x and y are numbers, else (NilValue, false).

func RawGet

func RawGet(t *Table, k Value) Value

RawGet returns the item in a table for the given key, or nil if t is nil. It doesn't check the metatable of t.

func RunChunk1

func RunChunk1(source []byte, def RuntimeContextDef, stdout io.Writer, opts ...RuntimeOption) (v Value, err error)

RunChunk1 runs source code in a runtime constrained by def. It returns the value returned by the chunk and possibly an error if execution failed (including when the runtime was killed).

func StringValue

func StringValue(s string) (v Value)

StringValue returns a Value holding the given arg.

func Sub

func Sub(x, y Value) (Value, bool)

Sub returns (z, true) where z is the value representing x-y if x and y are numbers, else (NilValue, false).

func TableValue

func TableValue(t *Table) Value

TableValue returns a Value holding the given arg.

func ThreadValue

func ThreadValue(t *Thread) Value

ThreadValue returns a Value holding the given arg.

func Unm

func Unm(x Value) (Value, bool)

Unm returns (z, true) where z is the value representing -x if x is a number, else (NilValue, false).

func UnmarshalConst

func UnmarshalConst(r io.Reader, budget uint64) (v Value, used uint64, err error)

UnmarshalConst reads from r to deserialize a const value.

func UserDataValue

func UserDataValue(u *UserData) Value

UserDataValue returns a Value holding the given arg.

func (Value) AsArray

func (v Value) AsArray() []Value

AsArray returns v as a [] (or panics).

func (Value) AsBool

func (v Value) AsBool() bool

AsBool returns v as a bool (or panics).

func (Value) AsCallable

func (v Value) AsCallable() Callable

AsCallable returns v as a Callable if possible (or panics)). It is an optimisation as type assertion in Go seems to have a significant cost.

func (Value) AsClosure

func (v Value) AsClosure() *Closure

AsClosure returns v as a *Closure (or panics).

func (Value) AsCode

func (v Value) AsCode() *Code

AsCode returns v as a *Code (or panics).

func (Value) AsCont

func (v Value) AsCont() Cont

AsCont returns v as a Cont, by looking at the concrete type (or panics). It is an optimisation as type assertion in Go seems to have a significant cost.

func (Value) AsFloat

func (v Value) AsFloat() float64

AsFloat returns v as a float64 (or panics).

func (Value) AsInt

func (v Value) AsInt() int64

AsInt returns v as a int64 (or panics).

func (Value) AsString

func (v Value) AsString() string

AsString returns v as a string (or panics).

func (Value) AsTable

func (v Value) AsTable() *Table

AsTable returns v as a *Table (or panics).

func (Value) AsThread

func (v Value) AsThread() *Thread

AsThread returns v as a *Thread (or panics).

func (Value) AsUserData

func (v Value) AsUserData() *UserData

AsUserData returns v as a *UserData (or panics).

func (Value) CustomTypeName

func (v Value) CustomTypeName() string

CustomTypeName is like TypeName but can be changed if the metatable has a __name field.

func (Value) Equals

func (v Value) Equals(v2 Value) bool

Equals returns true if v is equal to v2. Provided that v and v2 have been built with the official constructor functions, it is equivalent to but slightly faster than '=='.

func (Value) Hash

func (v Value) Hash() uintptr

Hash returns a hash for the value.

func (Value) Interface

func (v Value) Interface() interface{}

Interface turns the Value into an interface. As AsValue, this can trigger allocations so use with caution.

func (Value) IsNaN

func (v Value) IsNaN() bool

IsNaN returns true if v is a FloatValue which has a NaN value. It is trying to do this as efficiently as possible.

func (Value) IsNil

func (v Value) IsNil() bool

IsNil returns true if v is nil.

func (Value) NumberType

func (v Value) NumberType() ValueType

NumberType return the ValueType of v if it is a number, otherwise UnknownType.

func (Value) ToString

func (v Value) ToString() (string, bool)

ToString returns a simple string representation of a Value. The boolean returned specifies whether this is a good string value or not ("good" should be defined).

func (Value) TryBool

func (v Value) TryBool() (b bool, ok bool)

TryBool converts v to type bool if possible (ok is false otherwise).

func (Value) TryCallable

func (v Value) TryCallable() (c Callable, ok bool)

TryCallable converts v to type Callable if possible by looking at the possible concrete types (ok is false otherwise). It is an optimisation as type assertion in Go seems to have a significant cost.

func (Value) TryClosure

func (v Value) TryClosure() (c *Closure, ok bool)

TryClosure converts v to type *Closure if possible (ok is false otherwise).

func (Value) TryCode

func (v Value) TryCode() (c *Code, ok bool)

TryCode converts v to type *Code if possible (ok is false otherwise).

func (Value) TryCont

func (v Value) TryCont() (c Cont, ok bool)

TryCont returns v as a Cont, by looking at the concrete type (ok is false if it doesn't implement the Cont interface). It is an optimisation as type assertion in Go seems to have a significant cost.

func (Value) TryFloat

func (v Value) TryFloat() (n float64, ok bool)

TryFloat converts v to type float64 if possible (ok is false otherwise).

func (Value) TryInt

func (v Value) TryInt() (n int64, ok bool)

TryInt converts v to type int64 if possible (ok is false otherwise).

func (Value) TryString

func (v Value) TryString() (s string, ok bool)

TryString converts v to type string if possible (ok is false otherwise).

func (Value) TryTable

func (v Value) TryTable() (t *Table, ok bool)

TryTable converts v to type *Table if possible (ok is false otherwise).

func (Value) TryThread

func (v Value) TryThread() (t *Thread, ok bool)

TryThread converts v to type *Thread if possible (ok is false otherwise).

func (Value) TryUserData

func (v Value) TryUserData() (u *UserData, ok bool)

TryUserData converts v to type *UserData if possible (ok is false otherwise).

func (Value) Type

func (v Value) Type() ValueType

Type returns the ValueType of v.

func (Value) TypeName

func (v Value) TypeName() string

TypeName returns a string representing the type of the value (as in the Lua function type(v))

type ValueType

type ValueType uint8

ValueType represents the type of a lua Value.

const (
	NilType ValueType = iota
	IntType
	FloatType
	BoolType
	StringType
	CodeType
	TableType
	FunctionType
	ThreadType
	UserDataType
	UnknownType
)

Known ValueType values.

type Warner

type Warner interface {
	Warn(msgs ...string)
}

Warner is the interface for the Lua warning system. The Warn function emits warning, when called with one argument, if the argument starts with '@' then the message is a control message. These messages are not emitted but control the behaviour of the Warner instance.

Directories

Path Synopsis
internal
luagc
Package luagc implements weak refs and weak ref pools to be used by the Golua runtime.
Package luagc implements weak refs and weak ref pools to be used by the Golua runtime.

Jump to

Keyboard shortcuts

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