Search in sources :

Example 1 with LuaThread

use of org.luaj.vm2.LuaThread in project LuaViewSDK by alibaba.

the class DebugLib method onCall.

public void onCall(LuaClosure c, Varargs varargs, LuaValue[] stack) {
    LuaThread t = globals.running;
    callstack().onCall(c, varargs, stack);
    if (t.inhook)
        return;
    if (t.hookcall && t.hookfunc != null)
        callHook(CALL, NIL);
}
Also used : LuaThread(org.luaj.vm2.LuaThread)

Example 2 with LuaThread

use of org.luaj.vm2.LuaThread in project LuaViewSDK by alibaba.

the class DebugLib method onReturn.

public void onReturn() {
    LuaThread t = globals.running;
    callstack().onReturn();
    if (t.inhook)
        return;
    if (t.hookcall && t.hookfunc != null)
        callHook(RETURN, NIL);
}
Also used : LuaThread(org.luaj.vm2.LuaThread)

Example 3 with LuaThread

use of org.luaj.vm2.LuaThread in project LuaViewSDK by alibaba.

the class DebugLib method callHook.

void callHook(LuaValue type, LuaValue arg) {
    LuaThread t = globals.running;
    t.inhook = true;
    try {
        t.hookfunc.call(type, arg);
    } catch (LuaError e) {
        throw e;
    } catch (RuntimeException e) {
        throw new LuaError(e);
    } finally {
        t.inhook = false;
    }
}
Also used : LuaError(org.luaj.vm2.LuaError) LuaThread(org.luaj.vm2.LuaThread)

Example 4 with LuaThread

use of org.luaj.vm2.LuaThread in project LuaViewSDK by alibaba.

the class DebugLib method onCall.

public void onCall(LuaFunction f) {
    LuaThread t = globals.running;
    callstack().onCall(f);
    if (t.inhook)
        return;
    if (t.hookcall && t.hookfunc != null)
        callHook(CALL, NIL);
}
Also used : LuaThread(org.luaj.vm2.LuaThread)

Example 5 with LuaThread

use of org.luaj.vm2.LuaThread in project LuaViewSDK by alibaba.

the class DebugLib method onInstruction.

public void onInstruction(int pc, Varargs v, int top) {
    LuaThread t = globals.running;
    callstack().onInstruction(pc, v, top);
    if (t.inhook)
        return;
    if (t.hookfunc == null)
        return;
    if (t.hookcount > 0)
        if (++t.bytecodes % t.hookcount == 0)
            callHook(COUNT, NIL);
    if (t.hookline) {
        int newline = callstack().currentline();
        if (newline != t.lastline) {
            t.lastline = newline;
            callHook(LINE, LuaValue.valueOf(newline));
        }
    }
}
Also used : LuaThread(org.luaj.vm2.LuaThread) LuaPrint(org.luaj.vm2.log.LuaPrint)

Aggregations

LuaThread (org.luaj.vm2.LuaThread)5 LuaError (org.luaj.vm2.LuaError)1 LuaPrint (org.luaj.vm2.log.LuaPrint)1