Java Code Examples for org.luaj.vm2.LuaFunction#isclosure()
The following examples show how to use
org.luaj.vm2.LuaFunction#isclosure() .
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 VideoOS-Android-SDK with GNU General Public License v3.0 | 6 votes |
public void funcinfo(LuaFunction f) { if (f.isclosure()) { Prototype p = f.checkclosure().p; this.source = p.source != null ? p.source.tojstring() : "=?"; this.linedefined = p.linedefined; this.lastlinedefined = p.lastlinedefined; this.what = (this.linedefined == 0) ? "main" : "Lua"; this.short_src = p.shortsource(); } else { this.source = "=[Java]"; this.linedefined = -1; this.lastlinedefined = -1; this.what = "Java"; this.short_src = f.name(); } }
Example 2
Source File: DebugLib.java From XPrivacyLua with GNU General Public License v3.0 | 6 votes |
public void funcinfo(LuaFunction f) { if (f.isclosure()) { Prototype p = f.checkclosure().p; this.source = p.source != null ? p.source.tojstring() : "=?"; this.linedefined = p.linedefined; this.lastlinedefined = p.lastlinedefined; this.what = (this.linedefined == 0) ? "main" : "Lua"; this.short_src = p.shortsource(); } else { this.source = "=[Java]"; this.linedefined = -1; this.lastlinedefined = -1; this.what = "Java"; this.short_src = f.name(); } }
Example 3
Source File: DebugLib.java From HtmlNative with Apache License 2.0 | 6 votes |
public void funcinfo(LuaFunction f) { if (f.isclosure()) { Prototype p = f.checkclosure().p; this.source = p.source != null ? p.source.tojstring() : "=?"; this.linedefined = p.linedefined; this.lastlinedefined = p.lastlinedefined; this.what = (this.linedefined == 0) ? "main" : "Lua"; this.short_src = p.shortsource(); } else { this.source = "=[Java]"; this.linedefined = -1; this.lastlinedefined = -1; this.what = "Java"; this.short_src = f.name(); } }
Example 4
Source File: DebugLib.java From luaj with MIT License | 6 votes |
public void funcinfo(LuaFunction f) { if (f.isclosure()) { Prototype p = f.checkclosure().p; this.source = p.source != null ? p.source.tojstring() : "=?"; this.linedefined = p.linedefined; this.lastlinedefined = p.lastlinedefined; this.what = (this.linedefined == 0) ? "main" : "Lua"; this.short_src = p.shortsource(); } else { this.source = "=[Java]"; this.linedefined = -1; this.lastlinedefined = -1; this.what = "Java"; this.short_src = f.name(); } }
Example 5
Source File: DebugLib.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 4 votes |
DebugInfo auxgetinfo(String what, LuaFunction f, CallFrame ci) { DebugInfo ar = new DebugInfo(); for (int i = 0, n = what.length(); i < n; ++i) { switch (what.charAt(i)) { case 'S': ar.funcinfo(f); break; case 'l': ar.currentline = ci != null && ci.f.isclosure() ? ci.currentline() : -1; break; case 'u': if (f != null && f.isclosure()) { Prototype p = f.checkclosure().p; ar.nups = (short) p.upvalues.length; ar.nparams = (short) p.numparams; ar.isvararg = p.is_vararg != 0; } else { ar.nups = 0; ar.isvararg = true; ar.nparams = 0; } break; case 't': ar.istailcall = false; break; case 'n': { /* calling function is a known Lua function? */ if (ci != null && ci.previous != null) { if (ci.previous.f.isclosure()) { NameWhat nw = getfuncname(ci.previous); if (nw != null) { ar.name = nw.name; ar.namewhat = nw.namewhat; } } } if (ar.namewhat == null) { ar.namewhat = ""; /* not found */ ar.name = null; } break; } case 'L': case 'f': break; default: // TODO: return bad status. break; } } return ar; }
Example 6
Source File: DebugLib.java From XPrivacyLua with GNU General Public License v3.0 | 4 votes |
synchronized DebugInfo auxgetinfo(String what, LuaFunction f, CallFrame ci) { DebugInfo ar = new DebugInfo(); for (int i = 0, n = what.length(); i < n; ++i) { switch (what.charAt(i)) { case 'S': ar.funcinfo(f); break; case 'l': ar.currentline = ci != null && ci.f.isclosure()? ci.currentline(): -1; break; case 'u': if (f != null && f.isclosure()) { Prototype p = f.checkclosure().p; ar.nups = (short) p.upvalues.length; ar.nparams = (short) p.numparams; ar.isvararg = p.is_vararg != 0; } else { ar.nups = 0; ar.isvararg = true; ar.nparams = 0; } break; case 't': ar.istailcall = false; break; case 'n': { /* calling function is a known Lua function? */ if (ci != null && ci.previous != null) { if (ci.previous.f.isclosure()) { NameWhat nw = getfuncname(ci.previous); if (nw != null) { ar.name = nw.name; ar.namewhat = nw.namewhat; } } } if (ar.namewhat == null) { ar.namewhat = ""; /* not found */ ar.name = null; } break; } case 'L': case 'f': break; default: // TODO: return bad status. break; } } return ar; }
Example 7
Source File: DebugLib.java From HtmlNative with Apache License 2.0 | 4 votes |
synchronized DebugInfo auxgetinfo(String what, LuaFunction f, CallFrame ci) { DebugInfo ar = new DebugInfo(); for (int i = 0, n = what.length(); i < n; ++i) { switch (what.charAt(i)) { case 'S': ar.funcinfo(f); break; case 'l': ar.currentline = ci != null && ci.f.isclosure()? ci.currentline(): -1; break; case 'u': if (f != null && f.isclosure()) { Prototype p = f.checkclosure().p; ar.nups = (short) p.upvalues.length; ar.nparams = (short) p.numparams; ar.isvararg = p.is_vararg != 0; } else { ar.nups = 0; ar.isvararg = true; ar.nparams = 0; } break; case 't': ar.istailcall = false; break; case 'n': { /* calling function is a known Lua function? */ if (ci != null && ci.previous != null) { if (ci.previous.f.isclosure()) { NameWhat nw = getfuncname(ci.previous); if (nw != null) { ar.name = nw.name; ar.namewhat = nw.namewhat; } } } if (ar.namewhat == null) { ar.namewhat = ""; /* not found */ ar.name = null; } break; } case 'L': case 'f': break; default: // TODO: return bad status. break; } } return ar; }
Example 8
Source File: DebugLib.java From luaj with MIT License | 4 votes |
synchronized DebugInfo auxgetinfo(String what, LuaFunction f, CallFrame ci) { DebugInfo ar = new DebugInfo(); for (int i = 0, n = what.length(); i < n; ++i) { switch (what.charAt(i)) { case 'S': ar.funcinfo(f); break; case 'l': ar.currentline = ci != null && ci.f.isclosure()? ci.currentline(): -1; break; case 'u': if (f != null && f.isclosure()) { Prototype p = f.checkclosure().p; ar.nups = (short) p.upvalues.length; ar.nparams = (short) p.numparams; ar.isvararg = p.is_vararg != 0; } else { ar.nups = 0; ar.isvararg = true; ar.nparams = 0; } break; case 't': ar.istailcall = false; break; case 'n': { /* calling function is a known Lua function? */ if (ci != null && ci.previous != null) { if (ci.previous.f.isclosure()) { NameWhat nw = getfuncname(ci.previous); if (nw != null) { ar.name = nw.name; ar.namewhat = nw.namewhat; } } } if (ar.namewhat == null) { ar.namewhat = ""; /* not found */ ar.name = null; } break; } case 'L': case 'f': break; default: // TODO: return bad status. break; } } return ar; }