Java Code Examples for org.luaj.vm2.Varargs#checkthread()
The following examples show how to use
org.luaj.vm2.Varargs#checkthread() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DebugLib.java From luaj with MIT License | 6 votes |
public Varargs invoke(Varargs args) { int a=1; LuaThread t = args.isthread(a)? args.checkthread(a++): globals.running; 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++ ) switch ( str.charAt(i) ) { case 'c': call=true; break; case 'l': line=true; break; case 'r': rtrn=true; break; } LuaThread.State s = t.state; s.hookfunc = func; s.hookcall = call; s.hookline = line; s.hookcount = count; s.hookrtrn = rtrn; return NONE; }
Example 2
Source File: DebugLib.java From XPrivacyLua with GNU General Public License v3.0 | 6 votes |
public Varargs invoke(Varargs args) { int a=1; LuaThread t = args.isthread(a)? args.checkthread(a++): globals.running; 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++ ) switch ( str.charAt(i) ) { case 'c': call=true; break; case 'l': line=true; break; case 'r': rtrn=true; break; } LuaThread.State s = t.state; s.hookfunc = func; s.hookcall = call; s.hookline = line; s.hookcount = count; s.hookrtrn = rtrn; return NONE; }
Example 3
Source File: DebugLib.java From HtmlNative with Apache License 2.0 | 5 votes |
public Varargs invoke(Varargs args) { int a=1; LuaThread thread = args.isthread(a)? args.checkthread(a++): globals.running; String message = args.optjstring(a++, null); int level = args.optint(a++,1); String tb = callstack(thread).traceback(level); return valueOf(message!=null? message+"\n"+tb: tb); }
Example 4
Source File: DebugLib.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 5 votes |
public Varargs invoke(Varargs args) { LuaThread t = args.narg() > 0 ? args.checkthread(1) : globals.running; return varargsOf( t.hookfunc != null ? t.hookfunc : NIL, valueOf((t.hookcall ? "c" : "") + (t.hookline ? "l" : "") + (t.hookrtrn ? "r" : "")), valueOf(t.hookcount)); }
Example 5
Source File: DebugLib.java From HtmlNative with Apache License 2.0 | 5 votes |
public Varargs invoke(Varargs args) { int a=1; LuaThread thread = args.isthread(a)? args.checkthread(a++): globals.running; int level = args.checkint(a++); int local = args.checkint(a++); LuaValue value = args.arg(a++); CallFrame f = callstack(thread).getCallFrame(level); return f != null? f.setLocal(local, value): NONE; }
Example 6
Source File: DebugLib.java From luaj with MIT License | 5 votes |
public Varargs invoke(Varargs args) { LuaThread t = args.narg() > 0 ? args.checkthread(1): globals.running; LuaThread.State s = t.state; return varargsOf( s.hookfunc != null? s.hookfunc: NIL, valueOf((s.hookcall?"c":"")+(s.hookline?"l":"")+(s.hookrtrn?"r":"")), valueOf(s.hookcount)); }
Example 7
Source File: DebugLib.java From luaj with MIT License | 5 votes |
public Varargs invoke(Varargs args) { int a=1; LuaThread thread = args.isthread(a)? args.checkthread(a++): globals.running; int level = args.checkint(a++); int local = args.checkint(a++); CallFrame f = callstack(thread).getCallFrame(level); return f != null? f.getLocal(local): NONE; }
Example 8
Source File: DebugLib.java From HtmlNative with Apache License 2.0 | 5 votes |
public Varargs invoke(Varargs args) { LuaThread t = args.narg() > 0 ? args.checkthread(1): globals.running; LuaThread.State s = t.state; return varargsOf( s.hookfunc != null? s.hookfunc: NIL, valueOf((s.hookcall?"c":"")+(s.hookline?"l":"")+(s.hookrtrn?"r":"")), valueOf(s.hookcount)); }
Example 9
Source File: DebugLib.java From XPrivacyLua with GNU General Public License v3.0 | 5 votes |
public Varargs invoke(Varargs args) { int a=1; LuaThread thread = args.isthread(a)? args.checkthread(a++): globals.running; String message = args.optjstring(a++, null); int level = args.optint(a++,1); String tb = callstack(thread).traceback(level); return valueOf(message!=null? message+"\n"+tb: tb); }
Example 10
Source File: DebugLib.java From XPrivacyLua with GNU General Public License v3.0 | 5 votes |
public Varargs invoke(Varargs args) { int a=1; LuaThread thread = args.isthread(a)? args.checkthread(a++): globals.running; int level = args.checkint(a++); int local = args.checkint(a++); LuaValue value = args.arg(a++); CallFrame f = callstack(thread).getCallFrame(level); return f != null? f.setLocal(local, value): NONE; }
Example 11
Source File: DebugLib.java From XPrivacyLua with GNU General Public License v3.0 | 5 votes |
public Varargs invoke(Varargs args) { int a=1; LuaThread thread = args.isthread(a)? args.checkthread(a++): globals.running; int level = args.checkint(a++); int local = args.checkint(a++); CallFrame f = callstack(thread).getCallFrame(level); return f != null? f.getLocal(local): NONE; }
Example 12
Source File: DebugLib.java From luaj with MIT License | 5 votes |
public Varargs invoke(Varargs args) { int a=1; LuaThread thread = args.isthread(a)? args.checkthread(a++): globals.running; int level = args.checkint(a++); int local = args.checkint(a++); LuaValue value = args.arg(a++); CallFrame f = callstack(thread).getCallFrame(level); return f != null? f.setLocal(local, value): NONE; }
Example 13
Source File: DebugLib.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 5 votes |
public Varargs invoke(Varargs args) { int a = 1; LuaThread thread = args.isthread(a) ? args.checkthread(a++) : globals.running; int level = args.checkint(a++); int local = args.checkint(a++); LuaValue value = args.arg(a++); CallFrame f = callstack(thread).getCallFrame(level); return f != null ? f.setLocal(local, value) : NONE; }
Example 14
Source File: DebugLib.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 5 votes |
public Varargs invoke(Varargs args) { int a = 1; LuaThread thread = args.isthread(a) ? args.checkthread(a++) : globals.running; int level = args.checkint(a++); int local = args.checkint(a++); CallFrame f = callstack(thread).getCallFrame(level); return f != null ? f.getLocal(local) : NONE; }
Example 15
Source File: DebugLib.java From XPrivacyLua with GNU General Public License v3.0 | 4 votes |
public Varargs invoke(Varargs args) { int a=1; LuaThread thread = args.isthread(a)? args.checkthread(a++): globals.running; LuaValue func = args.arg(a++); String what = args.optjstring(a++, "flnStu"); DebugLib.CallStack callstack = callstack(thread); // find the stack info DebugLib.CallFrame frame; if ( func.isnumber() ) { frame = callstack.getCallFrame(func.toint()); if (frame == null) return NONE; func = frame.f; } else if ( func.isfunction() ) { frame = callstack.findCallFrame(func); } else { return argerror(a-2, "function or level"); } // start a table DebugInfo ar = callstack.auxgetinfo(what, (LuaFunction) func, frame); LuaTable info = new LuaTable(); if (what.indexOf('S') >= 0) { info.set(WHAT, LUA); info.set(SOURCE, valueOf(ar.source)); info.set(SHORT_SRC, valueOf(ar.short_src)); info.set(LINEDEFINED, valueOf(ar.linedefined)); info.set(LASTLINEDEFINED, valueOf(ar.lastlinedefined)); } if (what.indexOf('l') >= 0) { info.set( CURRENTLINE, valueOf(ar.currentline) ); } if (what.indexOf('u') >= 0) { info.set(NUPS, valueOf(ar.nups)); info.set(NPARAMS, valueOf(ar.nparams)); info.set(ISVARARG, ar.isvararg? ONE: ZERO); } if (what.indexOf('n') >= 0) { info.set(NAME, LuaValue.valueOf(ar.name!=null? ar.name: "?")); info.set(NAMEWHAT, LuaValue.valueOf(ar.namewhat)); } if (what.indexOf('t') >= 0) { info.set(ISTAILCALL, ZERO); } if (what.indexOf('L') >= 0) { LuaTable lines = new LuaTable(); info.set(ACTIVELINES, lines); DebugLib.CallFrame cf; for (int l = 1; (cf=callstack.getCallFrame(l)) != null; ++l) if (cf.f == func) lines.insert(-1, valueOf(cf.currentline())); } if (what.indexOf('f') >= 0) { if (func != null) info.set( FUNC, func ); } return info; }
Example 16
Source File: CoroutineLib.java From XPrivacyLua with GNU General Public License v3.0 | 4 votes |
public Varargs invoke(Varargs args) { final LuaThread t = args.checkthread(1); return t.resume( args.subargs(2) ); }
Example 17
Source File: CoroutineLib.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 4 votes |
public Varargs invoke(Varargs args) { LuaThread t = args.checkthread(1); return t.resume(args.subargs(2)); }
Example 18
Source File: DebugLib.java From HtmlNative with Apache License 2.0 | 4 votes |
public Varargs invoke(Varargs args) { int a=1; LuaThread thread = args.isthread(a)? args.checkthread(a++): globals.running; LuaValue func = args.arg(a++); String what = args.optjstring(a++, "flnStu"); DebugLib.CallStack callstack = callstack(thread); // find the stack info DebugLib.CallFrame frame; if ( func.isnumber() ) { frame = callstack.getCallFrame(func.toint()); if (frame == null) return NONE; func = frame.f; } else if ( func.isfunction() ) { frame = callstack.findCallFrame(func); } else { return argerror(a-2, "function or level"); } // start a table DebugInfo ar = callstack.auxgetinfo(what, (LuaFunction) func, frame); LuaTable info = new LuaTable(); if (what.indexOf('S') >= 0) { info.set(WHAT, LUA); info.set(SOURCE, valueOf(ar.source)); info.set(SHORT_SRC, valueOf(ar.short_src)); info.set(LINEDEFINED, valueOf(ar.linedefined)); info.set(LASTLINEDEFINED, valueOf(ar.lastlinedefined)); } if (what.indexOf('l') >= 0) { info.set( CURRENTLINE, valueOf(ar.currentline) ); } if (what.indexOf('u') >= 0) { info.set(NUPS, valueOf(ar.nups)); info.set(NPARAMS, valueOf(ar.nparams)); info.set(ISVARARG, ar.isvararg? ONE: ZERO); } if (what.indexOf('n') >= 0) { info.set(NAME, LuaValue.valueOf(ar.name!=null? ar.name: "?")); info.set(NAMEWHAT, LuaValue.valueOf(ar.namewhat)); } if (what.indexOf('t') >= 0) { info.set(ISTAILCALL, ZERO); } if (what.indexOf('L') >= 0) { LuaTable lines = new LuaTable(); info.set(ACTIVELINES, lines); DebugLib.CallFrame cf; for (int l = 1; (cf=callstack.getCallFrame(l)) != null; ++l) if (cf.f == func) lines.insert(-1, valueOf(cf.currentline())); } if (what.indexOf('f') >= 0) { if (func != null) info.set( FUNC, func ); } return info; }
Example 19
Source File: CoroutineLib.java From luaj with MIT License | 4 votes |
public Varargs invoke(Varargs args) { final LuaThread t = args.checkthread(1); return t.resume( args.subargs(2) ); }
Example 20
Source File: CoroutineLib.java From HtmlNative with Apache License 2.0 | 4 votes |
public Varargs invoke(Varargs args) { final LuaThread t = args.checkthread(1); return t.resume( args.subargs(2) ); }