From 23d15010edc905a3b7c123e85ef6d1960d3da039 Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Tue, 21 Feb 2017 08:46:48 +0100 Subject: luaG_ functions --- src/lvm.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/lvm.js') diff --git a/src/lvm.js b/src/lvm.js index 6bbe997..97292cd 100644 --- a/src/lvm.js +++ b/src/lvm.js @@ -20,6 +20,7 @@ const llimit = require('./llimit.js'); const ldo = require('./ldo.js'); const ltm = require('./ltm.js'); const ltable = require('./ltable.js'); +const ldebug = require('./ldebug.js'); const TMS = ltm.TMS; const RA = function(L, base, i) { @@ -865,7 +866,7 @@ const luaV_objlen = function(L, ra, rb) { default: { tm = ltm.luaT_gettmbyobj(L, rb, TMS.TM_LEN); if (tm.ttisnil()) - throw new Error("attempt to get length"); // TODO: luaG_typeerror + ldebug.luaG_typeerror(L, rb, "get length of"); break; } } @@ -952,7 +953,7 @@ const luaV_finishget = function(L, t, key, val, slot, recur) { assert(!t.ttistable()); tm = ltm.luaT_gettmbyobj(L, t, TMS.TM_INDEX); if (tm.ttisnil()) - throw new Error(`attempt to index a ${tm.ttype()} value`); // TODO: luaG_typeerror + ldebug.luaG_typeerror(L, t, 'index'); } else { /* 't' is a table */ assert(slot.ttisnil()); tm = ltm.luaT_gettmbyobj(L, t, TMS.TM_INDEX); // TODO: fasttm @@ -1001,7 +1002,7 @@ const luaV_finishset = function(L, t, key, val, slot, recur) { } else { /* not a table; check metamethod */ tm = ltm.luaT_gettmbyobj(L, t, TMS.TM_NEWINDEX); if (tm.ttisnil()) - throw new Error(`attempt to index a ${tm.ttype()} value`); // TODO: luaG_typeerror + ldebug.luaG_typeerror(L, t, 'index'); } if (tm.ttisfunction()) { -- cgit v1.2.3-54-g00ecf