summaryrefslogtreecommitdiff
path: root/src/ltm.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-02 16:37:50 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-03 12:20:43 +1000
commitcb0295e52870f22c5dd1a1726342b8d4b147b1c5 (patch)
tree3655d4d6f4873ed246c00c0eb6680a06124f3046 /src/ltm.js
parent50820e54d065bffbb504e6b20b6c27802e102c25 (diff)
downloadfengari-cb0295e52870f22c5dd1a1726342b8d4b147b1c5.tar.gz
fengari-cb0295e52870f22c5dd1a1726342b8d4b147b1c5.tar.bz2
fengari-cb0295e52870f22c5dd1a1726342b8d4b147b1c5.zip
Refactor table implementation
Diffstat (limited to 'src/ltm.js')
-rw-r--r--src/ltm.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/ltm.js b/src/ltm.js
index c94d8f1..76e7b0c 100644
--- a/src/ltm.js
+++ b/src/ltm.js
@@ -7,6 +7,7 @@ const defs = require('./defs.js');
const lobject = require('./lobject.js');
const ldo = require('./ldo.js');
const lstate = require('./lstate.js');
+const ltable = require('./ltable.js');
const ldebug = require('./ldebug.js');
const lvm = require('./lvm.js');
const CT = defs.constant_types;
@@ -69,9 +70,9 @@ const luaT_init = function(L) {
*/
const luaT_objtypename = function(L, o) {
let mt;
- if ((o.ttistable() && (mt = o.metatable) !== null) ||
+ if ((o.ttistable() && (mt = o.value.metatable) !== null) ||
(o.ttisfulluserdata() && (mt = o.value.metatable) !== null)) {
- let name = lobject.table_index(mt, defs.to_luastring('__name', true));
+ let name = ltable.luaH_getstr(mt, defs.to_luastring('__name', true));
if (name.ttisstring())
return name.value;
}
@@ -142,13 +143,13 @@ const luaT_gettmbyobj = function(L, o, event) {
switch(o.ttnov()) {
case CT.LUA_TTABLE:
case CT.LUA_TUSERDATA:
- mt = o.metatable;
+ mt = o.value.metatable;
break;
default:
mt = L.l_G.mt[o.ttnov()];
}
- return mt ? lobject.table_index(mt, event) : lobject.luaO_nilobject;
+ return mt ? ltable.luaH_getstr(mt, event) : lobject.luaO_nilobject;
};
module.exports.TMS = TMS;