From 9e3acbbb3f0dc45cc1444645cd1b4585ef911017 Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Tue, 14 Feb 2017 09:13:20 +0100 Subject: Setting metatable manually until setmetatable is available Using a breakpoint flag on specific opcode to stop the program so we can manipulate the stack manually within the test --- src/ltm.js | 2 +- src/lvm.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ltm.js b/src/ltm.js index f963aa9..fc0d0ec 100644 --- a/src/ltm.js +++ b/src/ltm.js @@ -87,7 +87,7 @@ const luaT_gettmbyobj = function(L, o, event) { switch(o.ttnov()) { case CT.LUA_TTABLE: case CT.LUA_TTUSERDATA: - mt = o.value.metatable; + mt = o.metatable; break; default: // TODO: mt = G(L)->mt[ttnov(o)]; diff --git a/src/lvm.js b/src/lvm.js index d5c6c46..b0b5d53 100644 --- a/src/lvm.js +++ b/src/lvm.js @@ -68,6 +68,9 @@ const luaV_execute = function(L) { opcode = OC.OpCodes[i.opcode]; } + if (i.breakpoint) // TODO: remove, used until lapi + return; + switch (opcode) { case "OP_MOVE": { L.stack[ra] = L.stack[RB(L, base, i)]; -- cgit v1.2.3-70-g09d2