diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ltm.js | 2 | ||||
-rw-r--r-- | src/lvm.js | 24 |
2 files changed, 25 insertions, 1 deletions
@@ -73,7 +73,7 @@ const luaT_callbinTM = function(L, p1, p2, res, event) { }; const luaT_trybinTM = function(L, p1, p2, res, event) { - if (!luaT_gettmbyobj(L, p1, p2, res, event)) { + if (!luaT_callbinTM(L, p1, p2, res, event)) { throw new Error("TM error"); // TODO: luaG_error } }; @@ -169,6 +169,8 @@ const luaV_execute = function(L) { L.stack[ra] = new TValue(CT.LUA_TNUMFLT, op1.value + op2.value); } else { ltm.luaT_trybinTM(L, op1, op2, ra, TMS.TM_ADD); + debugger; + console.log(`TM_ADD: ${L.stack[ra].value} (${ra})`); base = ci.u.l.base; } break; @@ -185,6 +187,8 @@ const luaV_execute = function(L) { L.stack[ra] = new TValue(CT.LUA_TNUMFLT, op1.value - op2.value); } else { ltm.luaT_trybinTM(L, op1, op2, ra, TMS.TM_SUB); + debugger; + console.log(`TM_SUB: ${L.stack[ra].value} (${ra})`); base = ci.u.l.base; } break; @@ -201,6 +205,8 @@ const luaV_execute = function(L) { L.stack[ra] = new TValue(CT.LUA_TNUMFLT, k[i.B].value * op2.value); } else { ltm.luaT_trybinTM(L, op1, op2, ra, TMS.TM_MUL); + debugger; + console.log(`TM_MUL: ${L.stack[ra].value} (${ra})`); base = ci.u.l.base; } break; @@ -217,6 +223,8 @@ const luaV_execute = function(L) { L.stack[ra] = new TValue(CT.LUA_TNUMFLT, k[i.B].value % op2.value); } else { ltm.luaT_trybinTM(L, op1, op2, ra, TMS.TM_MOD); + debugger; + console.log(`TM_MOD: ${L.stack[ra].value} (${ra})`); base = ci.u.l.base; } break; @@ -231,6 +239,8 @@ const luaV_execute = function(L) { L.stack[ra] = new TValue(CT.LUA_TNUMFLT, Math.pow(op1.value, op2.value)); } else { ltm.luaT_trybinTM(L, op1, op2, ra, TMS.TM_POW); + debugger; + console.log(`TM_POW: ${L.stack[ra].value} (${ra})`); base = ci.u.l.base; } break; @@ -245,6 +255,8 @@ const luaV_execute = function(L) { L.stack[ra] = new TValue(CT.LUA_TNUMFLT, k[i.B].value / op2.value); } else { ltm.luaT_trybinTM(L, op1, op2, ra, TMS.TM_DIV); + debugger; + console.log(`TM_DIV: ${L.stack[ra].value} (${ra})`); base = ci.u.l.base; } break; @@ -261,6 +273,8 @@ const luaV_execute = function(L) { L.stack[ra] = new TValue(CT.LUA_TNUMFLT, (op1.value / op2.value)|0); } else { ltm.luaT_trybinTM(L, op1, op2, ra, TMS.TM_IDIV); + debugger; + console.log(`TM_IDIV: ${L.stack[ra].value} (${ra})`); base = ci.u.l.base; } break; @@ -275,6 +289,8 @@ const luaV_execute = function(L) { L.stack[ra] = new TValue(CT.LUA_TNUMINT, (op1.value & op2.value)|0); } else { ltm.luaT_trybinTM(L, op1, op2, ra, TMS.TM_BAND); + debugger; + console.log(`TM_BAND: ${L.stack[ra].value} (${ra})`); base = ci.u.l.base; } break; @@ -289,6 +305,8 @@ const luaV_execute = function(L) { L.stack[ra] = new TValue(CT.LUA_TNUMINT, (op1.value | op2.value)|0); } else { ltm.luaT_trybinTM(L, op1, op2, ra, TMS.TM_BOR); + debugger; + console.log(`TM_BOR: ${L.stack[ra].value} (${ra})`); base = ci.u.l.base; } break; @@ -303,6 +321,8 @@ const luaV_execute = function(L) { L.stack[ra] = new TValue(CT.LUA_TNUMINT, (op1.value ^ op2.value)|0); } else { ltm.luaT_trybinTM(L, op1, op2, ra, TMS.TM_BXOR); + debugger; + console.log(`TM_BXOR: ${L.stack[ra].value} (${ra})`); base = ci.u.l.base; } break; @@ -317,6 +337,8 @@ const luaV_execute = function(L) { L.stack[ra] = new TValue(CT.LUA_TNUMINT, (op1.value << op2.value)|0); } else { ltm.luaT_trybinTM(L, op1, op2, ra, TMS.TM_SHL); + debugger; + console.log(`TM_SHL: ${L.stack[ra].value} (${ra})`); base = ci.u.l.base; } break; @@ -331,6 +353,8 @@ const luaV_execute = function(L) { L.stack[ra] = new TValue(CT.LUA_TNUMINT, (op1.value >> op2.value)|0); } else { ltm.luaT_trybinTM(L, op1, op2, ra, TMS.TM_SHR); + debugger; + console.log(`TM_SHR: ${L.stack[ra].value} (${ra})`); base = ci.u.l.base; } break; |