From ed7ac85c409ffec65aa86189f49e5d46e7a110bc Mon Sep 17 00:00:00 2001 From: daurnimator Date: Thu, 18 Jan 2018 07:17:59 +1100 Subject: src/: Destructure when requiring lstring.js --- src/lvm.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/lvm.js') diff --git a/src/lvm.js b/src/lvm.js index d0917b0..0f184a1 100644 --- a/src/lvm.js +++ b/src/lvm.js @@ -85,7 +85,11 @@ const { const lobject = require('./lobject.js'); const lfunc = require('./lfunc.js'); const lstate = require('./lstate.js'); -const lstring = require('./lstring.js'); +const { + luaS_bless, + luaS_eqlngstr, + luaS_hashlongstr +} = require('./lstring.js'); const ldo = require('./ldo.js'); const ltm = require('./ltm.js'); const ltable = require('./ltable.js'); @@ -762,7 +766,7 @@ const luaV_equalobj = function(L, t1, t2) { return t1.value === t2.value ? 1 : 0; case LUA_TSHRSTR: case LUA_TLNGSTR: { - return lstring.luaS_eqlngstr(t1.tsvalue(), t2.tsvalue()) ? 1 : 0; + return luaS_eqlngstr(t1.tsvalue(), t2.tsvalue()) ? 1 : 0; } case LUA_TUSERDATA: case LUA_TTABLE: @@ -880,8 +884,8 @@ const LEnum = function(l, r) { ** -larger than zero if 'ls' is smaller-equal-larger than 'rs'. */ const l_strcmp = function(ls, rs) { - let l = lstring.luaS_hashlongstr(ls); - let r = lstring.luaS_hashlongstr(rs); + let l = luaS_hashlongstr(ls); + let r = luaS_hashlongstr(rs); /* In fengari we assume string hash has same collation as byte values */ if (l === r) return 0; @@ -1060,7 +1064,7 @@ const luaV_concat = function(L, total) { } let buff = new Uint8Array(tl); copy2buff(L, top, n, buff); - let ts = lstring.luaS_bless(L, buff); + let ts = luaS_bless(L, buff); lobject.setsvalue2s(L, top - n, ts); } total -= n - 1; /* got 'n' strings to create 1 new */ -- cgit v1.2.3-54-g00ecf