Skip to content

LuaState abstract ​

abstractclassLuaStateextendsLuaBasicAPIimplementsLuaAuxLib,LuaCoroutineLib,LuaDebug,LuaEventAPI

Abstract base class for Lua state operations. Combines basic API, auxiliary library, coroutine support, and debug features.

Inheritance

Object → LuaBasicAPI → LuaState

Available Extensions

Constructors ​

LuaState() ​

LuaState()

Properties ​

hashCode no setter inherited ​

intgethashCode

The hash code for this object.

A hash code is a single integer which represents the state of the object that affects operator == comparisons.

All objects have hash codes. The default hash code implemented by Object represents only the identity of the object, the same way as the default operator == implementation only considers objects equal if they are identical (see identityHashCode).

If operator == is overridden to use the object state instead, the hash code must also be changed to represent that state, otherwise the object cannot be used in hash based data structures like the default Set and Map implementations.

Hash codes must be the same for objects that are equal to each other according to operator ==. The hash code of an object should only change if the object changes in a way that affects equality. There are no further requirements for the hash codes. They need not be consistent between executions of the same program and there are no distribution guarantees.

Objects that are not equal are allowed to have the same hash code. It is even technically allowed that all instances have the same hash code, but if clashes happen too often, it may reduce the efficiency of hash-based data structures like HashSet or HashMap.

If a subclass overrides hashCode, it should override the operator == operator as well to maintain consistency.

Inherited from Object.

Implementation
dart
external int get hashCode;

runtimeType no setter inherited ​

TypegetruntimeType

A representation of the runtime type of the object.

Inherited from Object.

Implementation
dart
external Type get runtimeType;

Methods ​

absIndex() inherited ​

intabsIndex(intidx)

Inherited from LuaBasicAPI.

Implementation
dart
int absIndex(int idx);

argCheck() inherited ​

voidargCheck(bool?cond,intarg,StringextraMsg)

Inherited from LuaAuxLib.

Implementation
dart
void argCheck(bool? cond, int arg, String extraMsg);

argError() inherited ​

intargError(intarg,StringextraMsg)

Inherited from LuaAuxLib.

Implementation
dart
int argError(int arg, String extraMsg);

arith() inherited ​

voidarith(ArithOpop)

Inherited from LuaBasicAPI.

Implementation
dart
void arith(ArithOp op);

call() inherited ​

voidcall(intnArgs,intnResults)

Inherited from LuaBasicAPI.

Implementation
dart
void call(int nArgs, int nResults);

callAsync() inherited ​

Future<void>callAsync(intnArgs,intnResults)

Asynchronously call a function. Use this when the function being called might be an async Dart function.

Inherited from LuaBasicAPI.

Implementation
dart
Future<void> callAsync(int nArgs, int nResults);

callCoroutineAsync() inherited ​

Future<void>callCoroutineAsync(intnArgs)

Async counterpart of call for the first invocation of a coroutine.

Like LuaBasicAPI.callAsync but additionally sets the _insideResumeAsync flag on the coroutine thread so that host async functions called via plain CALL (without await) inside the coroutine body are transparently awaited. Use this at the first resume of a coroutine where resumeAsync cannot be used because the closure has not yet started executing.

Inherited from LuaCoroutineLib.

Implementation
dart
Future<void> callCoroutineAsync(int nArgs);

callMeta() inherited ​

boolcallMeta(intobj,Stringe)

Inherited from LuaAuxLib.

Implementation
dart
bool callMeta(int obj, String e);

checkAny() inherited ​

voidcheckAny(intarg)

Inherited from LuaAuxLib.

Implementation
dart
void checkAny(int arg);

checkInteger() inherited ​

int?checkInteger(intarg)

Inherited from LuaAuxLib.

Implementation
dart
int? checkInteger(int arg);

checkNumber() inherited ​

double?checkNumber(intarg)

Inherited from LuaAuxLib.

Implementation
dart
double? checkNumber(int arg);

checkStack() inherited ​

boolcheckStack(intn)

Inherited from LuaBasicAPI.

Implementation
dart
bool checkStack(int n);

checkStack2() inherited ​

voidcheckStack2(intsz,Stringmsg)

Inherited from LuaAuxLib.

Implementation
dart
void checkStack2(int sz, String msg);

checkString() inherited ​

String?checkString(intarg)

Inherited from LuaAuxLib.

Implementation
dart
String? checkString(int arg);

checkType() inherited ​

voidcheckType(intarg,LuaTypet)

Inherited from LuaAuxLib.

Implementation
dart
void checkType(int arg, LuaType t);

clearThreadWeakRef() inherited ​

voidclearThreadWeakRef()

Clears weak references to dead threads.

Inherited from LuaCoroutineLib.

Implementation
dart
void clearThreadWeakRef();

compare() inherited ​

boolcompare(intidx1,intidx2,CmpOpop)

Inherited from LuaBasicAPI.

Implementation
dart
bool compare(int idx1, int idx2, CmpOp op);

concat() inherited ​

voidconcat(intn)

Inherited from LuaBasicAPI.

Implementation
dart
void concat(int n);

copy() inherited ​

voidcopy(intfromIdx,inttoIdx)

Inherited from LuaBasicAPI.

Implementation
dart
void copy(int fromIdx, int toIdx);

createTable() inherited ​

voidcreateTable(intnArr,intnRec)

Inherited from LuaBasicAPI.

Implementation
dart
void createTable(int nArr, int nRec);

debugThread() inherited ​

StringdebugThread()

Returns debug information about all threads.

Inherited from LuaCoroutineLib.

Implementation
dart
String debugThread();

doFile() inherited ​

booldoFile(Stringfilename)

Inherited from LuaAuxLib.

Implementation
dart
bool doFile(String filename);

doFileAsync() inherited ​

Future<bool>doFileAsync(Stringfilename)

Asynchronously execute a Lua file. Use this when the file might call async Dart functions.

Inherited from LuaAuxLib.

Implementation
dart
Future<bool> doFileAsync(String filename);

doString() inherited ​

booldoString(Stringstr)

Inherited from LuaAuxLib.

Implementation
dart
bool doString(String str);

doStringAsync() inherited ​

Future<bool>doStringAsync(Stringstr)

Asynchronously execute a Lua string. Use this when the code might call async Dart functions.

Inherited from LuaAuxLib.

Implementation
dart
Future<bool> doStringAsync(String str);

emit() inherited ​

voidemit(Stringevent, [List<dynamic>args= const []])

Emit event synchronously, firing all registered listeners from both Dart and Lua sides.

args are passed to each listener. Only Dart-primitive types (null, bool, int, double, String) are automatically converted to Lua stack values when calling Lua listeners.

Normally, listeners must not mutate args. This will affect subsequent listeners.

Inherited from LuaEventAPI.

Implementation
dart
void emit(String event, [List<dynamic> args = const []]);

emitAsync() inherited ​

Future<void>emitAsync(Stringevent, [List<dynamic>args= const []])

Emit event asynchronously, firing all registered listeners.

Async listeners (both Dart and Lua) are awaited. Sync listeners are called synchronously within the async flow.

Inherited from LuaEventAPI.

Implementation
dart
Future<void> emitAsync(String event, [List<dynamic> args = const []]);

error() inherited ​

interror()

Inherited from LuaBasicAPI.

Implementation
dart
int error();

error2() inherited ​

interror2(Stringfmt, [List<Object?>?a])

Inherited from LuaAuxLib.

Implementation
dart
int error2(String fmt, [List<Object?>? a]);

getCurrentNResults() inherited ​

intgetCurrentNResults()

Gets the number of expected results for current closure.

Inherited from LuaCoroutineLib.

Implementation
dart
int getCurrentNResults();

getField() inherited ​

LuaTypegetField(intidx,String?k)

Inherited from LuaBasicAPI.

Implementation
dart
LuaType getField(int idx, String? k);

getGlobal() inherited ​

LuaTypegetGlobal(Stringname)

Inherited from LuaBasicAPI.

Implementation
dart
LuaType getGlobal(String name);

getI() inherited ​

LuaTypegetI(intidx,inti)

Inherited from LuaBasicAPI.

Implementation
dart
LuaType getI(int idx, int i);

getMetafield() inherited ​

LuaTypegetMetafield(intobj,Stringe)

Inherited from LuaAuxLib.

Implementation
dart
LuaType getMetafield(int obj, String e);

getMetatable() inherited ​

boolgetMetatable(intidx)

Inherited from LuaBasicAPI.

Implementation
dart
bool getMetatable(int idx);

getMetatableAux() inherited ​

LuaTypegetMetatableAux(Stringtname)

Inherited from LuaAuxLib.

Implementation
dart
LuaType getMetatableAux(String tname);

getStatus() inherited ​

ThreadStatusgetStatus()

Gets the current thread status.

Inherited from LuaCoroutineLib.

Implementation
dart
ThreadStatus getStatus();

getSubTable() inherited ​

boolgetSubTable(intidx,Stringfname)

Inherited from LuaAuxLib.

Implementation
dart
bool getSubTable(int idx, String fname);

getTable() inherited ​

LuaTypegetTable(intidx)

Inherited from LuaBasicAPI.

Implementation
dart
LuaType getTable(int idx);

getTop() inherited ​

intgetTop()

Inherited from LuaBasicAPI.

Implementation
dart
int getTop();

insert() inherited ​

voidinsert(intidx)

Inherited from LuaBasicAPI.

Implementation
dart
void insert(int idx);

isBoolean() inherited ​

boolisBoolean(intidx)

Inherited from LuaBasicAPI.

Implementation
dart
bool isBoolean(int idx);

isDartFunction() inherited ​

boolisDartFunction(intidx)

Inherited from LuaBasicAPI.

Implementation
dart
bool isDartFunction(int idx);

isFunction() inherited ​

boolisFunction(intidx)

Inherited from LuaBasicAPI.

Implementation
dart
bool isFunction(int idx);

isInteger() inherited ​

boolisInteger(intidx)

Inherited from LuaBasicAPI.

Implementation
dart
bool isInteger(int idx);

isNil() inherited ​

boolisNil(intidx)

Inherited from LuaBasicAPI.

Implementation
dart
bool isNil(int idx);

isNone() inherited ​

boolisNone(intidx)

Inherited from LuaBasicAPI.

Implementation
dart
bool isNone(int idx);

isNoneOrNil() inherited ​

boolisNoneOrNil(intidx)

Inherited from LuaBasicAPI.

Implementation
dart
bool isNoneOrNil(int idx);

isNumber() inherited ​

boolisNumber(intidx)

Inherited from LuaBasicAPI.

Implementation
dart
bool isNumber(int idx);

isString() inherited ​

boolisString(intidx)

Inherited from LuaBasicAPI.

Implementation
dart
bool isString(int idx);

isTable() inherited ​

boolisTable(intidx)

Inherited from LuaBasicAPI.

Implementation
dart
bool isTable(int idx);

isThread() inherited ​

boolisThread(intidx)

Inherited from LuaBasicAPI.

Implementation
dart
bool isThread(int idx);

isUserdata() inherited ​

boolisUserdata(intidx)

Inherited from LuaBasicAPI.

Implementation
dart
bool isUserdata(int idx);

len() inherited ​

voidlen(intidx)

Inherited from LuaBasicAPI.

Implementation
dart
void len(int idx);

len2() inherited ​

int?len2(intidx)

Inherited from LuaAuxLib.

Implementation
dart
int? len2(int idx);

load() inherited ​

ThreadStatusload(Uint8Listchunk,StringchunkName,String?mode, {CompileOptionscompileOptions= CompileOptions.baseline,});

Inherited from LuaBasicAPI.

Implementation
dart
ThreadStatus load(Uint8List chunk, String chunkName, String? mode,
    {CompileOptions compileOptions = CompileOptions.baseline});

loadFile() inherited ​

ThreadStatusloadFile(String?filename)

Inherited from LuaAuxLib.

Implementation
dart
ThreadStatus loadFile(String? filename);

loadFileX() inherited ​

ThreadStatusloadFileX(String?filename,String?mode)

Inherited from LuaAuxLib.

Implementation
dart
ThreadStatus loadFileX(String? filename, String? mode);

loadString() inherited ​

ThreadStatusloadString(Strings)

Inherited from LuaAuxLib.

Implementation
dart
ThreadStatus loadString(String s);

loadStringX() inherited ​

ThreadStatusloadStringX(Strings, {CompileOptionscompileOptions= CompileOptions.baseline,});

Variant of loadString that accepts CompileOptions so the caller can request a specific optimization tier or the heuristic auto policy. Mirrors the loadFile / loadFileX pairing.

Inherited from LuaAuxLib.

Implementation
dart
ThreadStatus loadStringX(String s,
    {CompileOptions compileOptions = CompileOptions.baseline});

newLib() inherited ​

voidnewLib(Map<String,intFunction(LuaStatels)?>l)

Inherited from LuaAuxLib.

Implementation
dart
void newLib(Map<String, DartFunction?> l);

newLibTable() inherited ​

voidnewLibTable(Map<String,intFunction(LuaStatels)>l)

Inherited from LuaAuxLib.

Implementation
dart
void newLibTable(Map<String, DartFunction> l);

newMetatable() inherited ​

boolnewMetatable(Stringtname)

Inherited from LuaAuxLib.

Implementation
dart
bool newMetatable(String tname);

newTable() inherited ​

voidnewTable()

Inherited from LuaBasicAPI.

Implementation
dart
void newTable();

newThread() inherited ​

LuaStatenewThread()

Creates a new thread (coroutine) that shares the global environment.

Inherited from LuaCoroutineLib.

Implementation
dart
LuaState newThread();

newUserdata() inherited ​

Userdata<dynamic>newUserdata<T>()

Inherited from LuaBasicAPI.

Implementation
dart
Userdata newUserdata<T>();

next() inherited ​

boolnext(intidx)

Inherited from LuaBasicAPI.

Implementation
dart
bool next(int idx);

noSuchMethod() inherited ​

dynamicnoSuchMethod(Invocationinvocation)

Invoked when a nonexistent method or property is accessed.

A dynamic member invocation can attempt to call a member which doesn't exist on the receiving object. Example:

dart
dynamic object = 1;
object.add(42); // Statically allowed, run-time error

This invalid code will invoke the noSuchMethod method of the integer 1 with an Invocation representing the .add(42) call and arguments (which then throws).

Classes can override noSuchMethod to provide custom behavior for such invalid dynamic invocations.

A class with a non-default noSuchMethod invocation can also omit implementations for members of its interface. Example:

dart
class MockList<T> implements List<T> {
  noSuchMethod(Invocation invocation) {
    log(invocation);
    super.noSuchMethod(invocation); // Will throw.
  }
}
void main() {
  MockList().add(42);
}

This code has no compile-time warnings or errors even though the MockList class has no concrete implementation of any of the List interface methods. Calls to List methods are forwarded to noSuchMethod, so this code will log an invocation similar to Invocation.method(#add, [42]) and then throw.

If a value is returned from noSuchMethod, it becomes the result of the original invocation. If the value is not of a type that can be returned by the original invocation, a type error occurs at the invocation.

The default behavior is to throw a NoSuchMethodError.

Inherited from Object.

Implementation
dart
@pragma("vm:entry-point")
@pragma("wasm:entry-point")
external dynamic noSuchMethod(Invocation invocation);

off() inherited ​

voidoff(Stringevent, {voidFunction(List<dynamic>args)?callback,Future<void>Function(List<dynamic>args)?asyncCallback,int?listenerId,});

Remove a listener from event.

If callback is provided, removes the first sync Dart listener whose callback matches by reference equality. If asyncCallback is provided, removes the first async Dart listener whose callback matches by reference equality. If listenerId is provided, removes the listener with that id regardless of event name.

Inherited from LuaEventAPI.

Implementation
dart
void off(String event,
    {EventCallback? callback,
    EventCallbackAsync? asyncCallback,
    int? listenerId});

offById() inherited ​

voidoffById(intlistenerId)

Remove a listener by its unique id.

Inherited from LuaEventAPI.

Implementation
dart
void offById(int listenerId);

on() inherited ​

inton(Stringevent,voidFunction(List<dynamic>args)callback)

Register a synchronous Dart listener for event. Returns a listener id that can be passed to offById.

Inherited from LuaEventAPI.

Implementation
dart
int on(String event, EventCallback callback);

onAsync() inherited ​

intonAsync(Stringevent,Future<void>Function(List<dynamic>args)callback,);

Register an asynchronous Dart listener for event. Returns a listener id that can be passed to offById.

Inherited from LuaEventAPI.

Implementation
dart
int onAsync(String event, EventCallbackAsync callback);

once() inherited ​

intonce(Stringevent,voidFunction(List<dynamic>args)callback)

Register a one-time synchronous Dart listener for event. The listener is automatically removed after its first invocation. Returns a listener id.

Inherited from LuaEventAPI.

Implementation
dart
int once(String event, EventCallback callback);

openLibs() inherited ​

voidopenLibs()

Inherited from LuaAuxLib.

Implementation
dart
void openLibs();

optInteger() inherited ​

int?optInteger(intarg,int?d)

Inherited from LuaAuxLib.

Implementation
dart
int? optInteger(int arg, int? d);

optNumber() inherited ​

double?optNumber(intarg,doubled)

Inherited from LuaAuxLib.

Implementation
dart
double? optNumber(int arg, double d);

optString() inherited ​

String?optString(intarg,Stringd)

Inherited from LuaAuxLib.

Implementation
dart
String? optString(int arg, String d);

pCall() inherited ​

ThreadStatuspCall(intnArgs,intnResults,intmsgh)

Inherited from LuaBasicAPI.

Implementation
dart
ThreadStatus pCall(int nArgs, int nResults, int msgh);

pCallAsync() inherited ​

Future<ThreadStatus>pCallAsync(intnArgs,intnResults,intmsgh)

Asynchronously call a function in protected mode. Use this when the function being called might be an async Dart function.

Inherited from LuaBasicAPI.

Implementation
dart
Future<ThreadStatus> pCallAsync(int nArgs, int nResults, int msgh);

pop() inherited ​

voidpop(intn)

Inherited from LuaBasicAPI.

Implementation
dart
void pop(int n);

popObject() inherited ​

Object?popObject()

Pops and returns the top value from the stack as a Dart object.

Inherited from LuaCoroutineLib.

Implementation
dart
Object? popObject();

popStackFrame() inherited ​

voidpopStackFrame()

Pops the top stack frame (used after yield is caught).

Inherited from LuaCoroutineLib.

Implementation
dart
void popStackFrame();

printStack() extension ​

voidprintStack()

Available on LuaState, provided by the LuaStateDebug extension

Implementation
dart
void printStack() {
  print(">------  stack  top  ------<");
  var len = getTop();
  for (int i = len; i >= 1; i--) {
    LuaType t = type(i);
    switch (type(i)) {
      case LuaType.luaNone:
        _print(i, t);
        break;

      case LuaType.luaNil:
        _print(i, t);
        break;

      case LuaType.luaBoolean:
        _print(i, t, toBoolean(i) ? "true" : "false");
        break;

      case LuaType.luaLightUserdata:
        _print(i, t);
        break;

      case LuaType.luaNumber:
        if (isInteger(i)) {
          _print(i, t, "(integer)${toInteger(i)}");
        } else if (isNumber(i)) {
          _print(i, t, "${toNumber(i)}");
        }
        break;

      case LuaType.luaString:
        _print(i, t, "${toStr(i)}");
        break;

      case LuaType.luaTable:
        _print(i, t);
        break;

      case LuaType.luaFunction:
        _print(i, t);
        break;

      case LuaType.luaUserdata:
        _print(i, t);
        break;

      case LuaType.luaThread:
        _print(i, t);
        break;
      &#47;&#47; default:
      &#47;&#47;   _print(i, t, typeName(t));
      &#47;&#47;   break;
    }
  }
  print(">------ stack bottom ------<");
}

pushBoolean() inherited ​

voidpushBoolean(boolb)

Inherited from LuaBasicAPI.

Implementation
dart
void pushBoolean(bool b);

pushDartClosure() inherited ​

voidpushDartClosure(intFunction(LuaStatels)f,intn)

Inherited from LuaBasicAPI.

Implementation
dart
void pushDartClosure(DartFunction f, int n);

pushDartClosureAsync() inherited ​

voidpushDartClosureAsync(Future<int>Function(LuaStatels)f,intn, [String?name,]);

Push an async Dart closure onto the stack with upvalues. name is an optional human-readable name used to format the "attempt to call async function name without await or in non-async context" runtime error message.

Inherited from LuaBasicAPI.

Implementation
dart
void pushDartClosureAsync(DartFunctionAsync f, int n, [String? name]);

pushDartFunction() inherited ​

voidpushDartFunction(intFunction(LuaStatels)f)

Inherited from LuaBasicAPI.

Implementation
dart
void pushDartFunction(DartFunction f);

pushDartFunctionAsync() inherited ​

voidpushDartFunctionAsync(Future<int>Function(LuaStatels)f, [String?name,]);

Push an async Dart function onto the stack. name is an optional human-readable name used to format the "attempt to call async function name without await or in non-async context" runtime error message.

Inherited from LuaBasicAPI.

Implementation
dart
void pushDartFunctionAsync(DartFunctionAsync f, [String? name]);

pushFString() inherited ​

voidpushFString(Stringfmt, [List<Object>?a])

Inherited from LuaBasicAPI.

Implementation
dart
void pushFString(String fmt, [List<Object>? a]);

pushGlobalTable() inherited ​

voidpushGlobalTable()

Inherited from LuaBasicAPI.

Implementation
dart
void pushGlobalTable();

pushInteger() inherited ​

voidpushInteger(int?n)

Inherited from LuaBasicAPI.

Implementation
dart
void pushInteger(int? n);

pushNil() inherited ​

voidpushNil()

Inherited from LuaBasicAPI.

Implementation
dart
void pushNil();

pushNumber() inherited ​

voidpushNumber(doublen)

Inherited from LuaBasicAPI.

Implementation
dart
void pushNumber(double n);

pushString() inherited ​

voidpushString(String?s)

Inherited from LuaBasicAPI.

Implementation
dart
void pushString(String? s);

pushThread() inherited ​

voidpushThread(LuaStateL)

Pushes a thread onto the stack.

Inherited from LuaCoroutineLib.

Implementation
dart
void pushThread(LuaState L);

pushValue() inherited ​

voidpushValue(intidx)

Inherited from LuaBasicAPI.

Implementation
dart
void pushValue(int idx);

rawEqual() inherited ​

boolrawEqual(intidx1,intidx2)

Inherited from LuaBasicAPI.

Implementation
dart
bool rawEqual(int idx1, int idx2);

rawGet() inherited ​

LuaTyperawGet(intidx)

Inherited from LuaBasicAPI.

Implementation
dart
LuaType rawGet(int idx);

rawGetI() inherited ​

LuaTyperawGetI(intidx,inti)

Inherited from LuaBasicAPI.

Implementation
dart
LuaType rawGetI(int idx, int i);

rawLen() inherited ​

intrawLen(intidx)

Inherited from LuaBasicAPI.

Implementation
dart
int rawLen(int idx);

rawSet() inherited ​

voidrawSet(intidx)

Inherited from LuaBasicAPI.

Implementation
dart
void rawSet(int idx);

rawSetI() inherited ​

voidrawSetI(intidx,inti)

Inherited from LuaBasicAPI.

Implementation
dart
void rawSetI(int idx, int i);

ref() inherited ​

intref(intt)

Inherited from LuaAuxLib.

Implementation
dart
int ref(int t);

register() inherited ​

voidregister(Stringname,intFunction(LuaStatels)f)

Inherited from LuaBasicAPI.

Implementation
dart
void register(String name, DartFunction f);

registerAsync() inherited ​

voidregisterAsync(Stringname,Future<int>Function(LuaStatels)f)

Register an async Dart function as a global function.

Inherited from LuaAuxLib.

Implementation
dart
void registerAsync(String name, DartFunctionAsync f);

remove() inherited ​

voidremove(intidx)

Inherited from LuaBasicAPI.

Implementation
dart
void remove(int idx);

removeAllListeners() inherited ​

voidremoveAllListeners([String?event])

Remove all listeners for event, or all listeners for all events if event is null.

WARNING: Removing all listeners is a dangerous operation. Use at your own risk.

Inherited from LuaEventAPI.

Implementation
dart
void removeAllListeners([String? event]);

replace() inherited ​

voidreplace(intidx)

Inherited from LuaBasicAPI.

Implementation
dart
void replace(int idx);

requireF() inherited ​

voidrequireF(Stringmodname,intFunction(LuaStatels)openf,boolglb)

Inherited from LuaAuxLib.

Implementation
dart
void requireF(String modname, DartFunction openf, bool glb);

resetTopClosureNResults() inherited ​

voidresetTopClosureNResults(intnResults)

Resets the expected number of results for the top closure.

Inherited from LuaCoroutineLib.

Implementation
dart
void resetTopClosureNResults(int nResults);

resume() inherited ​

voidresume(intnArgs)

Resumes a suspended coroutine.

Inherited from LuaCoroutineLib.

Implementation
dart
void resume(int nArgs);

resumeAsync() inherited ​

Future<void>resumeAsync(intnArgs)

Asynchronously resumes a suspended coroutine.

Use this when the coroutine body may call host-registered async functions (registered via LuaAuxLib.registerAsync) without the await keyword. The async dispatch in LuaStateImpl treats the coroutine thread as the suspension point, so async calls inside the coroutine body are awaited transparently.

Inherited from LuaCoroutineLib.

Implementation
dart
Future<void> resumeAsync(int nArgs);

rotate() inherited ​

voidrotate(intidx,intn)

Inherited from LuaBasicAPI.

Implementation
dart
void rotate(int idx, int n);

runningId() inherited ​

intrunningId()

Returns the unique ID of this thread.

Inherited from LuaCoroutineLib.

Implementation
dart
int runningId();

setField() inherited ​

voidsetField(intidx,String?k)

Inherited from LuaBasicAPI.

Implementation
dart
void setField(int idx, String? k);

setFuncs() inherited ​

voidsetFuncs(Map<String,intFunction(LuaStatels)?>l,intnup)

Inherited from LuaAuxLib.

Implementation
dart
void setFuncs(Map<String, DartFunction?> l, int nup);

setGlobal() inherited ​

voidsetGlobal(Stringname)

Inherited from LuaBasicAPI.

Implementation
dart
void setGlobal(String name);

setHook() inherited ​

voidsetHook(HookContextcontext)

Sets a debug hook.

Inherited from LuaDebug.

Implementation
dart
void setHook(HookContext context);

setI() inherited ​

voidsetI(intidx,int?i)

Inherited from LuaBasicAPI.

Implementation
dart
void setI(int idx, int? i);

setMetatable() inherited ​

voidsetMetatable(intidx)

Inherited from LuaBasicAPI.

Implementation
dart
void setMetatable(int idx);

setMetatableAux() inherited ​

voidsetMetatableAux(Stringtname)

Inherited from LuaAuxLib.

Implementation
dart
void setMetatableAux(String tname);

setStatus() inherited ​

voidsetStatus(ThreadStatusstatus)

Sets the thread status.

Inherited from LuaCoroutineLib.

Implementation
dart
void setStatus(ThreadStatus status);

setTable() inherited ​

voidsetTable(intidx)

Inherited from LuaBasicAPI.

Implementation
dart
void setTable(int idx);

setTop() inherited ​

voidsetTop(intidx)

Inherited from LuaBasicAPI.

Implementation
dart
void setTop(int idx);

stringToNumber() inherited ​

boolstringToNumber(Strings)

Inherited from LuaBasicAPI.

Implementation
dart
bool stringToNumber(String s);

toBoolean() inherited ​

booltoBoolean(intidx)

Inherited from LuaBasicAPI.

Implementation
dart
bool toBoolean(int idx);

toDartFunction() inherited ​

intFunction(LuaStatels)?toDartFunction(intidx)

Inherited from LuaBasicAPI.

Implementation
dart
DartFunction? toDartFunction(int idx);

toInteger() inherited ​

inttoInteger(intidx)

Inherited from LuaBasicAPI.

Implementation
dart
int toInteger(int idx);

toIntegerX() inherited ​

int?toIntegerX(intidx)

Inherited from LuaBasicAPI.

Implementation
dart
int? toIntegerX(int idx);

toNumber() inherited ​

doubletoNumber(intidx)

Inherited from LuaBasicAPI.

Implementation
dart
double toNumber(int idx);

toNumberX() inherited ​

double?toNumberX(intidx)

Inherited from LuaBasicAPI.

Implementation
dart
double? toNumberX(int idx);

toPointer() inherited ​

Object?toPointer(intidx)

Inherited from LuaBasicAPI.

Implementation
dart
Object? toPointer(int idx);

toStr() inherited ​

String?toStr(intidx)

Inherited from LuaBasicAPI.

Implementation
dart
String? toStr(int idx);

toString() inherited ​

StringtoString()

A string representation of this object.

Some classes have a default textual representation, often paired with a static parse function (like int.parse). These classes will provide the textual representation as their string representation.

Other classes have no meaningful textual representation that a program will care about. Such classes will typically override toString to provide useful information when inspecting the object, mainly for debugging or logging.

Inherited from Object.

Implementation
dart
external String toString();

toString2() inherited ​

String?toString2(intidx)

Inherited from LuaAuxLib.

Implementation
dart
String? toString2(int idx);

toThread() inherited ​

LuaState?toThread(intidx)

Converts the value at the given index to a Lua thread (coroutine). Returns null if the value is not a thread.

Inherited from LuaCoroutineLib.

Implementation
dart
LuaState? toThread(int idx);

toUserdata() inherited ​

Userdata<dynamic>?toUserdata<T>(intidx)

Inherited from LuaBasicAPI.

Implementation
dart
Userdata? toUserdata<T>(int idx);

traceStack() inherited ​

StringtraceStack()

Returns a stack trace for debugging.

Inherited from LuaCoroutineLib.

Implementation
dart
String traceStack();

type() inherited ​

LuaTypetype(intidx)

Inherited from LuaBasicAPI.

Implementation
dart
LuaType type(int idx);

typeName() inherited ​

StringtypeName(LuaTypetp)

Inherited from LuaBasicAPI.

Implementation
dart
String typeName(LuaType tp);

typeName2() inherited ​

StringtypeName2(intidx)

Inherited from LuaAuxLib.

Implementation
dart
String typeName2(int idx);

unRef() inherited ​

voidunRef(intt,intref)

Inherited from LuaAuxLib.

Implementation
dart
void unRef(int t, int ref);

xmove() inherited ​

voidxmove(LuaStatefrom,intn)

Moves n values from one state to another. Pops the values from 'from' and pushes them to this state.

Inherited from LuaCoroutineLib.

Implementation
dart
void xmove(LuaState from, int n);

Operators ​

operator ==() inherited ​

booloperator ==(Objectother)

The equality operator.

The default behavior for all Objects is to return true if and only if this object and other are the same object.

Override this method to specify a different equality relation on a class. The overriding method must still be an equivalence relation. That is, it must be:

  • Total: It must return a boolean for all arguments. It should never throw.

  • Reflexive: For all objects o, o == o must be true.

  • Symmetric: For all objects o1 and o2, o1 == o2 and o2 == o1 must either both be true, or both be false.

  • Transitive: For all objects o1, o2, and o3, if o1 == o2 and o2 == o3 are true, then o1 == o3 must be true.

The method should also be consistent over time, so whether two objects are equal should only change if at least one of the objects was modified.

If a subclass overrides the equality operator, it should override the hashCode method as well to maintain consistency.

Inherited from Object.

Implementation
dart
external bool operator ==(Object other);

Static Methods ​

newState() ​

LuaStatenewState()
Implementation
dart
static LuaState newState() {
  return LuaStateImpl();
}