StdRuntime class

Implement the standard runtime. Initialize the libraries we are interested in using.

Inheritance
Mixed-in types

Constructors

StdRuntime(StdRuntimeResults results)

Properties

context LuaObject?
Shorthand for scope.context.
no setterinherited
coroutineImpls CoroutineCallbacks?
Support coroutines by setting this field to a non-null implementation.
getter/setter pairinherited
debugPath String?
For diagnostics or debugging, what the current script path is. See onRequireImpl.
getter/setter pairinherited
global Scope
The top-most scope. Note globals are actually written to globalEnv.
finalinherited
globalEnv LuaObject
_ENV variable.
finalinherited
globalG LuaObject
Legacy _G variable points to _ENV.
latefinalinherited
hasContext bool
Shorthand for scope.hasContext.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
onRequireImpl LuaRequireCallback?
Describes to do when lua processes the require() function.
getter/setter pairinherited
onRequireImplComplete ↔ void Function(String)?
This is called by the closure defined in initStdRequire after the call to Std.onRequireImpl. In this way, programmers can configure the implementation details of require on a case-by-case basis (if needed) while still performing general book keeping for each.
getter/setter pairinherited
results BaseResults
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scope Scope
The current scope.
getter/setter pairinherited
stdOut List<String>
A list of all output from lua print().
final

Methods

addDiagnostic(String info) → void
Build a meaningful diagnostic message from the current runtime information and original message info.
inherited
addError(String err) → void
Build a meaningful error message from the current runtime information and original message err.
inherited
addWarning(String warn) → void
Build a meaningful warning message from the current runtime information and original message warn.
inherited
callLuaFunction(LuaObject obj, {List<Object?> args = const [], LuaExceptionCallback? onException}) List<LuaObject>
Given a callable lua obj and a list of args, configure a new scope with the provided args as parameters based on the LuaObject.funcDef record. Args exceeding the parameter list will be dropped. Any remaining parameters will be filled by LuaObject.nil values. Any exceptions are caught and tracked for the trace back later. The scope is popped and any return result LuaObjects are returned as an argpack.
inherited
debugSetPath(String? path) → void
Setter for debugPath.
inherited
defGlobal(LuaObject value) LuaObject
Defines a global variable in the global scope with lua object value.
inherited
defLocal(LuaObject value) LuaObject
Defines a local variable in the current scope with lua object value.
inherited
findOnSelf(String field, {Object? or}) LuaObject?
First finds field inside object "self" in the current scope. If neither can be found, or is returned cast toLua. If or is not provided, null is returned.
inherited
findVar(String id) LuaObject?
Searches for a variable with the identifier id in the current scope. The implementation details also searches the parents in order if not found locally until such an id is found.
inherited
findVarArgs() List<LuaObject>?
Search the current scope for the special ... identifier.
inherited
initMiscRuntime() → void
inherited
initStdCoroutines({required CoroutineCallbacks impl}) → void
inherited
initStdIPairs() → void
inherited
initStdMath() → void
inherited
initStdMetatables() → void
Defines the following global functions:
inherited
initStdNext() → void
inherited
initStdPairs() → void
inherited
initStdPrint({StdPrintCallback? impl}) → void
inherited
initStdRequire() → void
inherited
initStdRuntime() → void
inherited
initStdStrings() → void
inherited
initStdTable() → void
inherited
lineInfo(Token token) String
Given a Token, return that token's line information. This is useful for debugging.
inherited
lineTag(Token token) String
For variables, return (row, col) as a virtual identifier stub. This is useful for debugging.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pushScope({LuaObject? context, Scope? parent}) → void
A reverse linked list implementation where tail points towards head (the parent chain). Calling this function adds a new Scope node in the linked list as the new tail and sets scope to point to the latest tail node. Every node points to its Scope.parent.
inherited
restoreScope(Scope next) → void
inherited
tokenId(Token token, {String? prefix}) String
Given a Token, construct a lua identifier stub. If prefix is non null, then the stub will have that prefix.
inherited
toString() String
A string representation of this object.
inherited
visitAssignMultiStmt(AssignMultiStmt assignMultiStmt) Object?
inherited
visitAssignStmt(AssignStmt assignStmt) Object?
Visits rhs first and then evaluate lhs.
inherited
visitAST(AST ast) Object?
The starting point of all lua programs. This will visit every node in the tree. The default result will be a program which ran to completion.
inherited
visitBinaryExpr(BinaryExpr expr) Object?
inherited
visitBooleanLiteral(BooleanLiteral boolean) Object?
inherited
visitBreakStmt(BreakStmt stmt) Object?
inherited
visitDeclArg(DeclArg declArg) Object?
inherited
visitDeclMultiVar(DeclMultiVar declMultiVar) Object?
inherited
visitDeclVar(DeclVar declVar) Object?
inherited
visitDoBlockStmt(DoBlockStmt doBlockStmt) Object?
inherited
visitForIterLoopStmt(ForIterLoopStmt forIterLoopStmt) Object?
inherited
visitForLoopStmt(ForLoopStmt forLoopStmt) Object?
inherited
visitFuncExpr(FuncExpr expr) Object?
inherited
visitGotoLabelStmt(GotoLabelStmt stmt) Object?
inherited
visitGotoStmt(GotoStmt stmt) Object?
inherited
visitGroupExpr(GroupExpr groupExpr) Object?
inherited
visitIfStmt(IfStmt stmt) Object?
inherited
visitKeyValStmt(KeyValStmt keyval) Object?
inherited
visitMemoryAccess(MemoryAccess memoryAccess) Object?
inherited
visitNilLiteral(NilLiteral nil) Object?
inherited
visitNotExpr(NotExpr notExpr) Object?
inherited
visitNumberLiteral(NumberLiteral number) Object?
inherited
visitRawExpr(RawExpr rawExpr) Object?
inherited
visitRepeatUntilLoopStmt(RepeatUntilLoopStmt repeatUntilLoopStmt) Object?
inherited
visitReturnStmt(ReturnStmt expr) Object?
inherited
visitSelfExpr(SelfExpr selfExpr) Object?
inherited
visitStringLiteral(StringLiteral string) Object?
inherited
visitTableLiteral(TableLiteral table) Object?
inherited
visitUnaryExpr(UnaryExpr expr) Object?
inherited
visitWhileLoopStmt(WhileLoopStmt whileLoopStmt) Object?
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited