Documentation
¶
Overview ¶
GopherLua: VM and compiler for Lua in Go
Index ¶
- Constants
- Variables
- func LVAsBool(v LValue) bool
- func LVAsString(v LValue) string
- func LVCanConvToString(v LValue) bool
- func LVIsFalse(v LValue) bool
- func OpenBase(L *LState) int
- func OpenChannel(L *LState) int
- func OpenCoroutine(L *LState) int
- func OpenDebug(L *LState) int
- func OpenIo(L *LState) int
- func OpenMath(L *LState) int
- func OpenOs(L *LState) int
- func OpenPackage(L *LState) int
- func OpenString(L *LState) int
- func OpenTable(L *LState) int
- func UpvalueIndex(i int) int
- type ApiError
- type ApiErrorType
- type CompileError
- type DbgCall
- type DbgLocalInfo
- type Debug
- type FunctionProto
- type Global
- type LBool
- type LChannel
- type LFunction
- type LGFunction
- type LNilType
- type LNumber
- type LState
- func (ls *LState) ArgError(n int, message string)
- func (ls *LState) Call(nargs, nret int)
- func (ls *LState) CallByParam(cp P, args ...LValue) error
- func (ls *LState) CallMeta(obj LValue, event string) LValue
- func (ls *LState) CheckAny(n int) LValue
- func (ls *LState) CheckBool(n int) bool
- func (ls *LState) CheckChannel(n int) chan LValue
- func (ls *LState) CheckFunction(n int) *LFunction
- func (ls *LState) CheckInt(n int) int
- func (ls *LState) CheckInt64(n int) int64
- func (ls *LState) CheckNumber(n int) LNumber
- func (ls *LState) CheckOption(n int, options []string) int
- func (ls *LState) CheckString(n int) string
- func (ls *LState) CheckTable(n int) *LTable
- func (ls *LState) CheckThread(n int) *LState
- func (ls *LState) CheckType(n int, typ LValueType)
- func (ls *LState) CheckTypes(n int, typs ...LValueType)
- func (ls *LState) CheckUserData(n int) *LUserData
- func (ls *LState) Close()
- func (ls *LState) Concat(values ...LValue) string
- func (ls *LState) Context() context.Context
- func (ls *LState) CreateTable(acap, hcap int) *LTable
- func (ls *LState) DoFile(path string) error
- func (ls *LState) DoString(source string) error
- func (ls *LState) Equal(lhs, rhs LValue) bool
- func (ls *LState) Error(lv LValue, level int)
- func (ls *LState) FindTable(obj *LTable, n string, size int) LValue
- func (ls *LState) ForEach(tb *LTable, cb func(LValue, LValue))
- func (ls *LState) GPCall(fn LGFunction, data LValue) error
- func (ls *LState) Get(idx int) LValue
- func (ls *LState) GetFEnv(obj LValue) LValue
- func (ls *LState) GetField(obj LValue, skey string) LValue
- func (ls *LState) GetGlobal(name string) LValue
- func (ls *LState) GetInfo(what string, dbg *Debug, fn LValue) (LValue, error)
- func (ls *LState) GetLocal(dbg *Debug, no int) (string, LValue)
- func (ls *LState) GetMetaField(obj LValue, event string) LValue
- func (ls *LState) GetMetatable(obj LValue) LValue
- func (ls *LState) GetStack(level int) (*Debug, bool)
- func (ls *LState) GetTable(obj LValue, key LValue) LValue
- func (ls *LState) GetTop() int
- func (ls *LState) GetTypeMetatable(typ string) LValue
- func (ls *LState) GetUpvalue(fn *LFunction, no int) (string, LValue)
- func (ls *LState) Insert(value LValue, index int)
- func (ls *LState) IsClosed() bool
- func (ls *LState) LessThan(lhs, rhs LValue) bool
- func (ls *LState) Load(reader io.Reader, name string) (*LFunction, error)
- func (ls *LState) LoadFile(path string) (*LFunction, error)
- func (ls *LState) LoadString(source string) (*LFunction, error)
- func (ls *LState) NewClosure(fn LGFunction, upvalues ...LValue) *LFunction
- func (ls *LState) NewFunction(fn LGFunction) *LFunction
- func (ls *LState) NewFunctionFromProto(proto *FunctionProto) *LFunction
- func (ls *LState) NewTable() *LTable
- func (ls *LState) NewThread() (*LState, context.CancelFunc)
- func (ls *LState) NewTypeMetatable(typ string) *LTable
- func (ls *LState) NewUserData() *LUserData
- func (ls *LState) Next(tb *LTable, key LValue) (LValue, LValue)
- func (ls *LState) ObjLen(v1 LValue) int
- func (ls *LState) OpenLibs()
- func (ls *LState) OptBool(n int, d bool) bool
- func (ls *LState) OptChannel(n int, ch chan LValue) chan LValue
- func (ls *LState) OptFunction(n int, d *LFunction) *LFunction
- func (ls *LState) OptInt(n int, d int) int
- func (ls *LState) OptInt64(n int, d int64) int64
- func (ls *LState) OptNumber(n int, d LNumber) LNumber
- func (ls *LState) OptString(n int, d string) string
- func (ls *LState) OptTable(n int, d *LTable) *LTable
- func (ls *LState) OptUserData(n int, d *LUserData) *LUserData
- func (ls *LState) PCall(nargs, nret int, errfunc *LFunction) (err error)
- func (ls *LState) Pop(n int)
- func (ls *LState) PreloadModule(name string, loader LGFunction)
- func (ls *LState) Push(value LValue)
- func (ls *LState) RaiseError(format string, args ...interface{})
- func (ls *LState) RawEqual(lhs, rhs LValue) bool
- func (ls *LState) RawGet(tb *LTable, key LValue) LValue
- func (ls *LState) RawGetInt(tb *LTable, key int) LValue
- func (ls *LState) RawSet(tb *LTable, key LValue, value LValue)
- func (ls *LState) RawSetInt(tb *LTable, key int, value LValue)
- func (ls *LState) Register(name string, fn LGFunction)
- func (ls *LState) RegisterModule(name string, funcs map[string]LGFunction) LValue
- func (ls *LState) Remove(index int)
- func (ls *LState) RemoveCallerFrame() *callFrame
- func (ls *LState) RemoveContext() context.Context
- func (ls *LState) Replace(idx int, value LValue)
- func (ls *LState) Resume(th *LState, fn *LFunction, args ...LValue) (ResumeState, error, []LValue)
- func (ls *LState) SetContext(ctx context.Context)
- func (ls *LState) SetFEnv(obj LValue, env LValue)
- func (ls *LState) SetField(obj LValue, key string, value LValue)
- func (ls *LState) SetFuncs(tb *LTable, funcs map[string]LGFunction, upvalues ...LValue) *LTable
- func (ls *LState) SetGlobal(name string, value LValue)
- func (ls *LState) SetLocal(dbg *Debug, no int, lv LValue) string
- func (ls *LState) SetMetatable(obj LValue, mt LValue)
- func (ls *LState) SetMx(mx int)
- func (ls *LState) SetTable(obj LValue, key LValue, value LValue)
- func (ls *LState) SetTop(idx int)
- func (ls *LState) SetUpvalue(fn *LFunction, no int, lv LValue) string
- func (ls *LState) Status(th *LState) string
- func (ls *LState) String() string
- func (ls *LState) ToBool(n int) bool
- func (ls *LState) ToChannel(n int) chan LValue
- func (ls *LState) ToFunction(n int) *LFunction
- func (ls *LState) ToInt(n int) int
- func (ls *LState) ToInt64(n int) int64
- func (ls *LState) ToNumber(n int) LNumber
- func (ls *LState) ToString(n int) string
- func (ls *LState) ToStringMeta(lv LValue) LValue
- func (ls *LState) ToTable(n int) *LTable
- func (ls *LState) ToThread(n int) *LState
- func (ls *LState) ToUserData(n int) *LUserData
- func (ls *LState) Type() LValueType
- func (ls *LState) TypeError(n int, typ LValueType)
- func (ls *LState) Where(level int) string
- func (ls *LState) XMoveTo(other *LState, n int)
- func (ls *LState) Yield(values ...LValue) int
- type LString
- type LTable
- func (tb *LTable) Append(value LValue)
- func (tb *LTable) ForEach(cb func(LValue, LValue))
- func (tb *LTable) Insert(i int, value LValue)
- func (tb *LTable) Len() int
- func (tb *LTable) MaxN() int
- func (tb *LTable) Next(key LValue) (LValue, LValue)
- func (tb *LTable) RawGet(key LValue) LValue
- func (tb *LTable) RawGetH(key LValue) LValue
- func (tb *LTable) RawGetInt(key int) LValue
- func (tb *LTable) RawGetString(key string) LValue
- func (tb *LTable) RawSet(key LValue, value LValue)
- func (tb *LTable) RawSetH(key LValue, value LValue)
- func (tb *LTable) RawSetInt(key int, value LValue)
- func (tb *LTable) RawSetString(key string, value LValue)
- func (tb *LTable) Remove(pos int) LValue
- func (tb *LTable) String() string
- func (tb *LTable) Type() LValueType
- type LUserData
- type LValue
- type LValueType
- type Options
- type P
- type ResumeState
- type Upvalue
Constants ¶
const ( VarArgHasArg uint8 = 1 VarArgIsVarArg uint8 = 2 VarArgNeedsArg uint8 = 4 )
const ( // BaseLibName is here for consistency; the base functions have no namespace/library. BaseLibName = "" // LoadLibName is here for consistency; the loading system has no namespace/library. LoadLibName = "package" // TabLibName is the name of the table Library. TabLibName = "table" // IoLibName is the name of the io Library. IoLibName = "io" // OsLibName is the name of the os Library. OsLibName = "os" // StringLibName is the name of the string Library. StringLibName = "string" // MathLibName is the name of the math Library. MathLibName = "math" // DebugLibName is the name of the debug Library. DebugLibName = "debug" // ChannelLibName is the name of the channel Library. ChannelLibName = "channel" // CoroutineLibName is the name of the coroutine Library. CoroutineLibName = "coroutine" )
const ( OP_MOVE int = iota /* A B R(A) := R(B) */ OP_MOVEN /* A B R(A) := R(B); followed by R(C) MOVE ops */ OP_LOADK /* A Bx R(A) := Kst(Bx) */ OP_LOADBOOL /* A B C R(A) := (Bool)B; if (C) pc++ */ OP_LOADNIL /* A B R(A) := ... := R(B) := nil */ OP_GETUPVAL /* A B R(A) := UpValue[B] */ OP_GETGLOBAL /* A Bx R(A) := Gbl[Kst(Bx)] */ OP_GETTABLE /* A B C R(A) := R(B)[RK(C)] */ OP_GETTABLEKS /* A B C R(A) := R(B)[RK(C)] ; RK(C) is constant string */ OP_SETGLOBAL /* A Bx Gbl[Kst(Bx)] := R(A) */ OP_SETUPVAL /* A B UpValue[B] := R(A) */ OP_SETTABLE /* A B C R(A)[RK(B)] := RK(C) */ OP_SETTABLEKS /* A B C R(A)[RK(B)] := RK(C) ; RK(B) is constant string */ OP_NEWTABLE /* A B C R(A) := {} (size = BC) */ OP_SELF /* A B C R(A+1) := R(B); R(A) := R(B)[RK(C)] */ OP_ADD /* A B C R(A) := RK(B) + RK(C) */ OP_SUB /* A B C R(A) := RK(B) - RK(C) */ OP_MUL /* A B C R(A) := RK(B) * RK(C) */ OP_DIV /* A B C R(A) := RK(B) / RK(C) */ OP_MOD /* A B C R(A) := RK(B) % RK(C) */ OP_POW /* A B C R(A) := RK(B) ^ RK(C) */ OP_UNM /* A B R(A) := -R(B) */ OP_NOT /* A B R(A) := not R(B) */ OP_LEN /* A B R(A) := length of R(B) */ OP_CONCAT /* A B C R(A) := R(B).. ... ..R(C) */ OP_JMP /* sBx pc+=sBx */ OP_EQ /* A B C if ((RK(B) == RK(C)) ~= A) then pc++ */ OP_LT /* A B C if ((RK(B) < RK(C)) ~= A) then pc++ */ OP_LE /* A B C if ((RK(B) <= RK(C)) ~= A) then pc++ */ OP_TEST /* A C if not (R(A) <=> C) then pc++ */ OP_TESTSET /* A B C if (R(B) <=> C) then R(A) := R(B) else pc++ */ OP_CALL /* A B C R(A) ... R(A+C-2) := R(A)(R(A+1) ... R(A+B-1)) */ OP_TAILCALL /* A B C return R(A)(R(A+1) ... R(A+B-1)) */ OP_RETURN /* A B return R(A) ... R(A+B-2) (see note) */ OP_FORLOOP /* A sBx R(A)+=R(A+2); if R(A) <?= R(A+1) then { pc+=sBx; R(A+3)=R(A) }*/ OP_FORPREP /* A sBx R(A)-=R(A+2); pc+=sBx */ OP_TFORLOOP /* A C R(A+3) ... R(A+3+C) := R(A)(R(A+1) R(A+2)); if R(A+3) ~= nil then { pc++; R(A+2)=R(A+3); } */ OP_SETLIST /* A B C R(A)[(C-1)*FPF+i] := R(A+i) 1 <= i <= B */ OP_CLOSE /* A close all variables in the stack up to (>=) R(A)*/ OP_CLOSURE /* A Bx R(A) := closure(KPROTO[Bx] R(A) ... R(A+n)) */ OP_VARARG /* A B R(A) R(A+1) ... R(A+B-1) = vararg */ OP_NOP /* NOP */ )
const EnvironIndex = -10001
const FramesPerSegment = 8
FramesPerSegment should be a power of 2 constant for performance reasons. It will allow the go compiler to change the divs and mods into bitshifts. Max is 256 due to current use of uint8 to count how many frames in a segment are used.
const GlobalsIndex = -10002
const LNumberBit = 64
const LNumberScanFormat = "%f"
const LuaVersion = "Lua 5.1"
const MultRet = -1
const PackageAuthors = "Yusuke Inuzuka"
const PackageCopyRight = PackageName + " " + PackageVersion + " Copyright (C) 2015 -2017 " + PackageAuthors
const PackageName = "GopherLua"
const PackageVersion = "0.1"
const RegistryIndex = -10000
Variables ¶
var CallStackSize = 256
var CompatVarArg = true
var FieldsPerFlush = 50
var LFalse = LBool(false)
var LNil = LValue(&LNilType{})
var LTrue = LBool(true)
var LuaDirSep string
var LuaExecDir = "!"
var LuaIgMark = "-"
var LuaLDir string
var LuaOS string
var LuaPath = "LUA_PATH"
var LuaPathDefault string
var LuaPathMark = "?"
var LuaPathSep = ";"
var MaxArrayIndex = 67108864
var MaxTableGetLoop = 100
var RegistryGrowStep = 32
var RegistrySize = 256 * 20
Functions ¶
func LVAsString ¶
LVAsString returns string representation of a given LValue if the LValue is a string or number, otherwise an empty string.
func LVCanConvToString ¶
LVCanConvToString returns true if a given LValue is a string or number otherwise false.
func OpenChannel ¶
func OpenCoroutine ¶
func OpenPackage ¶
func OpenString ¶
func UpvalueIndex ¶
Types ¶
type ApiError ¶
type ApiError struct {
Type ApiErrorType
Object LValue
StackTrace string
// Underlying error. This attribute is set only if the Type is ApiErrorFile or ApiErrorSyntax
Cause error
}
type ApiErrorType ¶
type ApiErrorType int
const ( ApiErrorSyntax ApiErrorType = iota ApiErrorFile ApiErrorRun ApiErrorError ApiErrorPanic )
type CompileError ¶
func (*CompileError) Error ¶
func (e *CompileError) Error() string
type DbgLocalInfo ¶
type FunctionProto ¶
type FunctionProto struct {
SourceName string
LineDefined int
LastLineDefined int
NumUpvalues uint8
NumParameters uint8
IsVarArg uint8
NumUsedRegisters uint8
Code []uint32
Constants []LValue
FunctionPrototypes []*FunctionProto
DbgSourcePositions []int
DbgLocals []*DbgLocalInfo
DbgCalls []DbgCall
DbgUpvalues []string
// contains filtered or unexported fields
}
func (*FunctionProto) String ¶
func (fp *FunctionProto) String() string
func (*FunctionProto) StringConstants ¶ added in v0.0.2
func (fp *FunctionProto) StringConstants() []string
StringConstants exposes the string-constants table used by the *KS opcodes and SETGLOBAL (backend access).
type LChannel ¶
type LChannel chan LValue
func (LChannel) Type ¶
func (ch LChannel) Type() LValueType
type LFunction ¶
type LFunction struct {
IsG bool
Env *LTable
Proto *FunctionProto
GFunction LGFunction
Upvalues []*Upvalue
}
func (*LFunction) Type ¶
func (fn *LFunction) Type() LValueType
type LGFunction ¶
type LNilType ¶
type LNilType struct{}
func (*LNilType) Type ¶
func (nl *LNilType) Type() LValueType
type LNumber ¶
type LNumber float64
func LVAsNumber ¶
LVAsNumber tries to convert a given LValue to a number.
func (LNumber) Type ¶
func (nm LNumber) Type() LValueType
type LState ¶
type LState struct {
G *Global
Parent *LState
Env *LTable
Panic func(*LState)
Dead bool
Options Options
// contains filtered or unexported fields
}
func (*LState) CheckChannel ¶
Checks whether the given index is an LChannel and returns this channel.
func (*LState) CheckFunction ¶
func (*LState) CheckInt64 ¶
func (*LState) CheckNumber ¶
func (*LState) CheckString ¶
func (*LState) CheckTable ¶
func (*LState) CheckThread ¶
func (*LState) CheckType ¶
func (ls *LState) CheckType(n int, typ LValueType)
func (*LState) CheckTypes ¶
func (ls *LState) CheckTypes(n int, typs ...LValueType)
func (*LState) CheckUserData ¶
func (*LState) Context ¶
Context returns the LState's context. To change the context, use WithContext.
func (*LState) CreateTable ¶
func (*LState) Error ¶
This function is equivalent to lua_error( http://www.lua.org/manual/5.1/manual.html#lua_error ).
func (*LState) GetMetatable ¶
func (*LState) GetTypeMetatable ¶
func (*LState) NewClosure ¶
func (ls *LState) NewClosure(fn LGFunction, upvalues ...LValue) *LFunction
func (*LState) NewFunction ¶
func (ls *LState) NewFunction(fn LGFunction) *LFunction
func (*LState) NewFunctionFromProto ¶
func (ls *LState) NewFunctionFromProto(proto *FunctionProto) *LFunction
func (*LState) NewThread ¶
func (ls *LState) NewThread() (*LState, context.CancelFunc)
NewThread returns a new LState that shares with the original state all global objects. If the original state has context.Context, the new state has a new child context of the original state and this function returns its cancel function.
func (*LState) NewTypeMetatable ¶
func (*LState) NewUserData ¶
func (*LState) OpenLibs ¶
func (ls *LState) OpenLibs()
OpenLibs loads the built-in libraries. It is equivalent to running OpenLoad, then OpenBase, then iterating over the other OpenXXX functions in any order.
func (*LState) OptChannel ¶
If the given index is a LChannel, returns this channel. If this argument is absent or is nil, returns ch. Otherwise, raises an error.
func (*LState) PreloadModule ¶
func (ls *LState) PreloadModule(name string, loader LGFunction)
Set a module loader to the package.preload table.
func (*LState) RaiseError ¶
This function is equivalent to luaL_error( http://www.lua.org/manual/5.1/manual.html#luaL_error ).
func (*LState) Register ¶
func (ls *LState) Register(name string, fn LGFunction)
func (*LState) RegisterModule ¶
func (ls *LState) RegisterModule(name string, funcs map[string]LGFunction) LValue
func (*LState) RemoveCallerFrame ¶
func (ls *LState) RemoveCallerFrame() *callFrame
RemoveCallerFrame removes the stack frame above the current stack frame. This is useful in tail calls. It returns the new current frame.
func (*LState) RemoveContext ¶
RemoveContext removes the context associated with this LState and returns this context.
func (*LState) SetContext ¶
SetContext set a context ctx to this LState. The provided ctx must be non-nil.
func (*LState) SetMetatable ¶
func (*LState) SetMx ¶
Set maximum memory size. This function can only be called from the main thread.
func (*LState) ToFunction ¶
func (*LState) ToStringMeta ¶
ToStringMeta returns string representation of given LValue. This method calls the `__tostring` meta method if defined.
func (*LState) ToUserData ¶
func (*LState) Type ¶
func (ls *LState) Type() LValueType
func (*LState) TypeError ¶
func (ls *LState) TypeError(n int, typ LValueType)
type LTable ¶
type LTable struct {
Metatable LValue
// contains filtered or unexported fields
}
func (*LTable) ForEach ¶
ForEach iterates over this table of elements, yielding each in turn to a given function.
func (*LTable) Next ¶
This function is equivalent to lua_next ( http://www.lua.org/manual/5.1/manual.html#lua_next ).
func (*LTable) RawGet ¶
RawGet returns an LValue associated with a given key without __index metamethod.
func (*LTable) RawGetH ¶
RawGet returns an LValue associated with a given key without __index metamethod.
func (*LTable) RawGetInt ¶
RawGetInt returns an LValue at position `key` without __index metamethod.
func (*LTable) RawGetString ¶
RawGetString returns an LValue associated with a given key without __index metamethod.
func (*LTable) RawSet ¶
RawSet sets a given LValue to a given index without the __newindex metamethod. It is recommended to use `RawSetString` or `RawSetInt` for performance if you already know the given LValue is a string or number.
func (*LTable) RawSetH ¶
RawSetH sets a given LValue to a given index without the __newindex metamethod.
func (*LTable) RawSetInt ¶
RawSetInt sets a given LValue at a position `key` without the __newindex metamethod.
func (*LTable) RawSetString ¶
RawSetString sets a given LValue to a given string index without the __newindex metamethod.
func (*LTable) Type ¶
func (tb *LTable) Type() LValueType
type LValue ¶
type LValue interface {
String() string
Type() LValueType
}
type LValueType ¶
type LValueType int
const ( LTNil LValueType = iota LTBool LTNumber LTString LTFunction LTUserData LTThread LTTable LTChannel )
func (LValueType) String ¶
func (vt LValueType) String() string
type Options ¶
type Options struct {
// Call stack size. This defaults to `lua.CallStackSize`.
CallStackSize int
// Data stack size. This defaults to `lua.RegistrySize`.
RegistrySize int
// Allow the registry to grow from the registry size specified up to a value of RegistryMaxSize. A value of 0
// indicates no growth is permitted. The registry will not shrink again after any growth.
RegistryMaxSize int
// If growth is enabled, step up by an additional `RegistryGrowStep` each time to avoid having to resize too often.
// This defaults to `lua.RegistryGrowStep`
RegistryGrowStep int
// Controls whether or not libraries are opened by default
SkipOpenLibs bool
// Tells whether a Go stacktrace should be included in a Lua stacktrace when panics occur.
IncludeGoStackTrace bool
// If `MinimizeStackMemory` is set, the call stack will be automatically grown or shrank up to a limit of
// `CallStackSize` in order to minimize memory usage. This does incur a slight performance penalty.
MinimizeStackMemory bool
}
Options is a configuration that is used to create a new LState.
type ResumeState ¶
type ResumeState int
const ( ResumeOK ResumeState = iota ResumeYield ResumeError )
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
clua-run
command
Command clua-run runs a Lua script under stock C Lua 5.1 (the wasm oracle blob, lua51_sjlj.wasm) with the CLI-arg surface the other runners provide — the third engine for _cli-tests:
|
Command clua-run runs a Lua script under stock C Lua 5.1 (the wasm oracle blob, lua51_sjlj.wasm) with the CLI-arg surface the other runners provide — the third engine for _cli-tests: |
|
glua
command
|
|
|
luafuzz
command
Command luafuzz is the M6e differential fuzzer CLI: a deterministic seeded generator driving the testdiff engines, with a chunk- resumable soak designed for a laptop that sleeps and moves between networks daily (all state under -dir; every interruption is safe).
|
Command luafuzz is the M6e differential fuzzer CLI: a deterministic seeded generator driving the testdiff engines, with a chunk- resumable soak designed for a laptop that sleeps and moves between networks daily (all state under -dir; every interruption is safe). |
|
luawasm-run
command
Command luawasm-run executes a module saved by cmd/luawasmc against the C-Lua rt_* runtime (embedded lua51_sjlj.wasm) on wasmtime — or on the pure-Go wazero production engine when GLUA_WASM_ENGINE=wazero (ledger row 32: one blob, two hosts).
|
Command luawasm-run executes a module saved by cmd/luawasmc against the C-Lua rt_* runtime (embedded lua51_sjlj.wasm) on wasmtime — or on the pure-Go wazero production engine when GLUA_WASM_ENGINE=wazero (ledger row 32: one blob, two hosts). |
|
luawasmc
command
Command luawasmc compiles a Lua 5.1 script to a WebAssembly module.
|
Command luawasmc compiles a Lua 5.1 script to a WebAssembly module. |
|
testdiff
command
Command testdiff runs a corpus across engines and reports log diffs.
|
Command testdiff runs a corpus across engines and reports log diffs. |
|
examples
|
|
|
eval
command
Command eval is the minimal host-package demonstration (design §6.3): compile once, run with KEYS/ARGV, print the reply values — plus one host function so the redis.call seam is visible end to end.
|
Command eval is the minimal host-package demonstration (design §6.3): compile once, run with KEYS/ARGV, print the reply values — plus one host function so the redis.call seam is visible end to end. |
|
evalserver
command
Command evalserver is the thread-proofing demonstration (design §6.3): concurrent EVALs against a pool of locked VMs — the deployment shape a daemon actually uses.
|
Command evalserver is the thread-proofing demonstration (design §6.3): concurrent EVALs against a pool of locked VMs — the deployment shape a daemon actually uses. |
|
sharedvm
command
Command sharedvm is the single-shared-VM deployment mode (design §6.3): one Lua memory image, many goroutines — VM.Run serializes on the image lock (A9) and scripts observe each other's globals, exactly like Redis-classic single-state script execution.
|
Command sharedvm is the single-shared-VM deployment mode (design §6.3): one Lua memory image, many goroutines — VM.Run serializes on the image lock (A9) and scripts observe each other's globals, exactly like Redis-classic single-state script execution. |
|
Package host is the public Go API a pure-Go daemon (the Ultima Redis clone) imports to run untrusted Lua scripts: compile to wasm, execute on wazero against the embedded production runtime blob, exchange values with in-script host functions (the redis.call seam).
|
Package host is the public Go API a pure-Go daemon (the Ultima Redis clone) imports to run untrusted Lua scripts: compile to wasm, execute on wazero against the embedded production runtime blob, exchange values with in-script host functions (the redis.call seam). |
|
Package luafuzz is the M6e differential fuzzer: a deterministic Lua program generator (design doc §8.4 L5) plus an interruptible, chunk-resumable soak runner (m6 plan §4.5/D6).
|
Package luafuzz is the M6e differential fuzzer: a deterministic Lua program generator (design doc §8.4 L5) plus an interruptible, chunk-resumable soak runner (m6 plan §4.5/D6). |
|
Package luawasm is the Lua→wasm backend (design doc §4, milestones M4–M5): FunctionProto trees from the gopher-lua frontend become wasm modules that share linear memory with the C runtime and call down through the frozen rt_* ABI (runtime/rt_abi.h).
|
Package luawasm is the Lua→wasm backend (design doc §4, milestones M4–M5): FunctionProto trees from the gopher-lua frontend become wasm modules that share linear memory with the C runtime and call down through the frozen rt_* ABI (runtime/rt_abi.h). |
|
Lua pattern match functions for Go
|
Lua pattern match functions for Go |
|
Package testdiff is the differential testing harness of the Lua→wasm project (docs/Lua-Wasm-Design-and-Test-Plan.md §7–§8, milestone M1).
|
Package testdiff is the differential testing harness of the Lua→wasm project (docs/Lua-Wasm-Design-and-Test-Plan.md §7–§8, milestone M1). |
|
Package wasm is a minimal, dependency-free emitter for WebAssembly 1.0/2.0 core binary modules.
|
Package wasm is a minimal, dependency-free emitter for WebAssembly 1.0/2.0 core binary modules. |