Examples of LuaThread


Examples of org.luaj.vm2.LuaThread

    return NONE;
  }
 
  static Varargs _gethook(Varargs args) {
    int a=1;
    LuaThread thread = args.isthread(a)? args.checkthread(a++): LuaThread.getRunning();
    DebugState ds = getDebugState(thread);
    return varargsOf(
        ds.hookfunc,
        valueOf((ds.hookcall?"c":"")+(ds.hookline?"l":"")+(ds.hookrtrn?"r":"")),
        valueOf(ds.hookcount));
View Full Code Here

Examples of org.luaj.vm2.LuaThread

        valueOf(ds.hookcount));
  }

  static Varargs _sethook(Varargs args) {
    int a=1;
    LuaThread thread = args.isthread(a)? args.checkthread(a++): LuaThread.getRunning();
    LuaValue func    = args.optfunction(a++, null);
    String str       = args.optjstring(a++,"");
    int count        = args.optint(a++,0);
    boolean call=false,line=false,rtrn=false;
    for ( int i=0; i<str.length(); i++ )
View Full Code Here

Examples of org.luaj.vm2.LuaThread

    return object;
  }
 
  protected static Varargs _getinfo(Varargs args, LuaValue level0func) {
    int a=1;
    LuaThread thread = args.isthread(a)? args.checkthread(a++): LuaThread.getRunning();
    LuaValue func = args.arg(a++);
    String what = args.optjstring(a++, "nSluf");
   
    // find the stack info
    DebugState ds = getDebugState( thread );
View Full Code Here

Examples of org.luaj.vm2.LuaThread

        return name;
  }
 
  static Varargs _getlocal(Varargs args) {
    int a=1;
    LuaThread thread = args.isthread(a)? args.checkthread(a++): LuaThread.getRunning();
    int level = args.checkint(a++);
    int local = args.checkint(a++);
   
    DebugState ds = getDebugState(thread);
    DebugInfo di = ds.getDebugInfo(level-1);
View Full Code Here

Examples of org.luaj.vm2.LuaThread

    }
  }

  static Varargs _setlocal(Varargs args) {
    int a=1;
    LuaThread thread = args.isthread(a)? args.checkthread(a++): LuaThread.getRunning();
    int level = args.checkint(a++);
    int local = args.checkint(a++);
    LuaValue value = args.arg(a++);
   
    DebugState ds = getDebugState(thread);
View Full Code Here

Examples of org.luaj.vm2.LuaThread

    return NIL;
  }

  static LuaValue _traceback(Varargs args) {
    int a=1;
    LuaThread thread = args.isthread(a)? args.checkthread(a++): LuaThread.getRunning();
    String message = args.optjstring(a++, null);
    int level = args.optint(a++,1);
    String tb = DebugLib.traceback(thread, level-1);
    return valueOf(message!=null? message+"\n"+tb: tb);
  }
View Full Code Here

Examples of org.luaj.vm2.LuaThread

    }
  }

  public static Varargs pcall(LuaValue func, Varargs args, LuaValue errfunc) {
    try {
      LuaThread thread = LuaThread.getRunning();
      LuaValue olderr = thread.err;
      try {
        thread.err = errfunc;
        return varargsOf(LuaValue.TRUE, func.invoke(args));
      } finally {
View Full Code Here

Examples of org.luaj.vm2.LuaThread

      case INIT: {
        return init();
      }
      case CREATE: {
        final LuaValue func = args.checkfunction(1);
        return new LuaThread(func, LuaThread.getGlobals() );
      }
      case RESUME: {
        final LuaThread t = args.checkthread(1);
        return t.resume( args.subargs(2) );
      }
      case RUNNING: {
        final LuaThread r = LuaThread.getRunning();
        return LuaThread.isMainThread(r)? NIL: r;
      }
      case STATUS: {
        return valueOf( args.checkthread(1).getStatus() );
      }
      case YIELD: {
        final LuaThread r = LuaThread.getRunning();
        if ( LuaThread.isMainThread( r ) )
          error("main thread can't yield");
        return r.yield( args );
      }
      case WRAP: {
        final LuaValue func = args.checkfunction(1);
        final LuaThread thread = new LuaThread(func, func.getfenv());
        CoroutineLib cl = new CoroutineLib();
        cl.setfenv(thread);
        cl.name = "wrapped";
        cl.opcode = WRAPPED;
        return cl;
      }
      case WRAPPED: {
        final LuaThread t = (LuaThread) env;
        final Varargs result = t.resume( args );
        if ( result.arg1().toboolean() ) {
          return result.subargs(2);
        } else {
          error( result.arg(2).tojstring() );
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.