summaryrefslogtreecommitdiff
path: root/src/ltm.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2018-01-18 07:17:59 +1100
committerdaurnimator <quae@daurnimator.com>2018-01-18 07:17:59 +1100
commited7ac85c409ffec65aa86189f49e5d46e7a110bc (patch)
tree9a02ed29652757dcf0ebc81b7db2c7da82474ca5 /src/ltm.js
parent8bedd949c894d61284b3ddd5b3bf989b651b95f8 (diff)
downloadfengari-ed7ac85c409ffec65aa86189f49e5d46e7a110bc.tar.gz
fengari-ed7ac85c409ffec65aa86189f49e5d46e7a110bc.tar.bz2
fengari-ed7ac85c409ffec65aa86189f49e5d46e7a110bc.zip
src/: Destructure when requiring lstring.js
Diffstat (limited to 'src/ltm.js')
-rw-r--r--src/ltm.js55
1 files changed, 29 insertions, 26 deletions
diff --git a/src/ltm.js b/src/ltm.js
index 79a483e..5e05f65 100644
--- a/src/ltm.js
+++ b/src/ltm.js
@@ -6,7 +6,10 @@ const defs = require('./defs.js');
const lobject = require('./lobject.js');
const ldo = require('./ldo.js');
const lstate = require('./lstate.js');
-const lstring = require('./lstring.js');
+const {
+ luaS_bless,
+ luaS_new
+} = require('./lstring.js');
const ltable = require('./ltable.js');
const ldebug = require('./ldebug.js');
const lvm = require('./lvm.js');
@@ -64,30 +67,30 @@ const TMS = {
};
const luaT_init = function(L) {
- L.l_G.tmname[TMS.TM_INDEX] = new lstring.luaS_new(L, defs.to_luastring("__index", true));
- L.l_G.tmname[TMS.TM_NEWINDEX] = new lstring.luaS_new(L, defs.to_luastring("__newindex", true));
- L.l_G.tmname[TMS.TM_GC] = new lstring.luaS_new(L, defs.to_luastring("__gc", true));
- L.l_G.tmname[TMS.TM_MODE] = new lstring.luaS_new(L, defs.to_luastring("__mode", true));
- L.l_G.tmname[TMS.TM_LEN] = new lstring.luaS_new(L, defs.to_luastring("__len", true));
- L.l_G.tmname[TMS.TM_EQ] = new lstring.luaS_new(L, defs.to_luastring("__eq", true));
- L.l_G.tmname[TMS.TM_ADD] = new lstring.luaS_new(L, defs.to_luastring("__add", true));
- L.l_G.tmname[TMS.TM_SUB] = new lstring.luaS_new(L, defs.to_luastring("__sub", true));
- L.l_G.tmname[TMS.TM_MUL] = new lstring.luaS_new(L, defs.to_luastring("__mul", true));
- L.l_G.tmname[TMS.TM_MOD] = new lstring.luaS_new(L, defs.to_luastring("__mod", true));
- L.l_G.tmname[TMS.TM_POW] = new lstring.luaS_new(L, defs.to_luastring("__pow", true));
- L.l_G.tmname[TMS.TM_DIV] = new lstring.luaS_new(L, defs.to_luastring("__div", true));
- L.l_G.tmname[TMS.TM_IDIV] = new lstring.luaS_new(L, defs.to_luastring("__idiv", true));
- L.l_G.tmname[TMS.TM_BAND] = new lstring.luaS_new(L, defs.to_luastring("__band", true));
- L.l_G.tmname[TMS.TM_BOR] = new lstring.luaS_new(L, defs.to_luastring("__bor", true));
- L.l_G.tmname[TMS.TM_BXOR] = new lstring.luaS_new(L, defs.to_luastring("__bxor", true));
- L.l_G.tmname[TMS.TM_SHL] = new lstring.luaS_new(L, defs.to_luastring("__shl", true));
- L.l_G.tmname[TMS.TM_SHR] = new lstring.luaS_new(L, defs.to_luastring("__shr", true));
- L.l_G.tmname[TMS.TM_UNM] = new lstring.luaS_new(L, defs.to_luastring("__unm", true));
- L.l_G.tmname[TMS.TM_BNOT] = new lstring.luaS_new(L, defs.to_luastring("__bnot", true));
- L.l_G.tmname[TMS.TM_LT] = new lstring.luaS_new(L, defs.to_luastring("__lt", true));
- L.l_G.tmname[TMS.TM_LE] = new lstring.luaS_new(L, defs.to_luastring("__le", true));
- L.l_G.tmname[TMS.TM_CONCAT] = new lstring.luaS_new(L, defs.to_luastring("__concat", true));
- L.l_G.tmname[TMS.TM_CALL] = new lstring.luaS_new(L, defs.to_luastring("__call", true));
+ L.l_G.tmname[TMS.TM_INDEX] = new luaS_new(L, defs.to_luastring("__index", true));
+ L.l_G.tmname[TMS.TM_NEWINDEX] = new luaS_new(L, defs.to_luastring("__newindex", true));
+ L.l_G.tmname[TMS.TM_GC] = new luaS_new(L, defs.to_luastring("__gc", true));
+ L.l_G.tmname[TMS.TM_MODE] = new luaS_new(L, defs.to_luastring("__mode", true));
+ L.l_G.tmname[TMS.TM_LEN] = new luaS_new(L, defs.to_luastring("__len", true));
+ L.l_G.tmname[TMS.TM_EQ] = new luaS_new(L, defs.to_luastring("__eq", true));
+ L.l_G.tmname[TMS.TM_ADD] = new luaS_new(L, defs.to_luastring("__add", true));
+ L.l_G.tmname[TMS.TM_SUB] = new luaS_new(L, defs.to_luastring("__sub", true));
+ L.l_G.tmname[TMS.TM_MUL] = new luaS_new(L, defs.to_luastring("__mul", true));
+ L.l_G.tmname[TMS.TM_MOD] = new luaS_new(L, defs.to_luastring("__mod", true));
+ L.l_G.tmname[TMS.TM_POW] = new luaS_new(L, defs.to_luastring("__pow", true));
+ L.l_G.tmname[TMS.TM_DIV] = new luaS_new(L, defs.to_luastring("__div", true));
+ L.l_G.tmname[TMS.TM_IDIV] = new luaS_new(L, defs.to_luastring("__idiv", true));
+ L.l_G.tmname[TMS.TM_BAND] = new luaS_new(L, defs.to_luastring("__band", true));
+ L.l_G.tmname[TMS.TM_BOR] = new luaS_new(L, defs.to_luastring("__bor", true));
+ L.l_G.tmname[TMS.TM_BXOR] = new luaS_new(L, defs.to_luastring("__bxor", true));
+ L.l_G.tmname[TMS.TM_SHL] = new luaS_new(L, defs.to_luastring("__shl", true));
+ L.l_G.tmname[TMS.TM_SHR] = new luaS_new(L, defs.to_luastring("__shr", true));
+ L.l_G.tmname[TMS.TM_UNM] = new luaS_new(L, defs.to_luastring("__unm", true));
+ L.l_G.tmname[TMS.TM_BNOT] = new luaS_new(L, defs.to_luastring("__bnot", true));
+ L.l_G.tmname[TMS.TM_LT] = new luaS_new(L, defs.to_luastring("__lt", true));
+ L.l_G.tmname[TMS.TM_LE] = new luaS_new(L, defs.to_luastring("__le", true));
+ L.l_G.tmname[TMS.TM_CONCAT] = new luaS_new(L, defs.to_luastring("__concat", true));
+ L.l_G.tmname[TMS.TM_CALL] = new luaS_new(L, defs.to_luastring("__call", true));
};
/*
@@ -99,7 +102,7 @@ const luaT_objtypename = function(L, o) {
let mt;
if ((o.ttistable() && (mt = o.value.metatable) !== null) ||
(o.ttisfulluserdata() && (mt = o.value.metatable) !== null)) {
- let name = ltable.luaH_getstr(mt, lstring.luaS_bless(L, __name));
+ let name = ltable.luaH_getstr(mt, luaS_bless(L, __name));
if (name.ttisstring())
return name.svalue();
}