diff options
author | daurnimator <quae@daurnimator.com> | 2017-04-26 18:55:22 +1000 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2017-04-26 18:55:22 +1000 |
commit | e9472c358593e359cba1ae7a5731a054683c564e (patch) | |
tree | 184502a123ef933b363768f1fe7f62e6301c16b0 /src | |
parent | 6db7eebe7211f1aacdf27971c7c4f3423a04fd34 (diff) | |
download | fengari-e9472c358593e359cba1ae7a5731a054683c564e.tar.gz fengari-e9472c358593e359cba1ae7a5731a054683c564e.tar.bz2 fengari-e9472c358593e359cba1ae7a5731a054683c564e.zip |
Remove pointless use internal string implementation
Diffstat (limited to 'src')
-rw-r--r-- | src/lstrlib.js | 5 | ||||
-rw-r--r-- | src/lutf8lib.js | 5 |
2 files changed, 1 insertions, 9 deletions
diff --git a/src/lstrlib.js b/src/lstrlib.js index 9bbf26a..950dca0 100644 --- a/src/lstrlib.js +++ b/src/lstrlib.js @@ -3,7 +3,6 @@ const assert = require('assert'); const sprintf = require('sprintf-js').sprintf; -const lapi = require('./lapi.js'); const lauxlib = require('./lauxlib.js'); const lobject = require('./lobject.js'); const lua = require('./lua.js'); @@ -38,15 +37,13 @@ const posrelat = function(pos, len) { const str_sub = function(L) { let s = lauxlib.luaL_checkstring(L, 1); - let ts = L.stack[lapi.index2addr_(L, 1)]; - s = ts.value; let l = s.length; let start = posrelat(lauxlib.luaL_checkinteger(L, 2), l); let end = posrelat(lauxlib.luaL_optinteger(L, 3, -1), l); if (start < 1) start = 1; if (end > l) end = l; if (start <= end) - lua.lua_pushstring(L, ts.value.slice(start - 1, (start - 1) + (end - start + 1))); + lua.lua_pushstring(L, s.slice(start - 1, (start - 1) + (end - start + 1))); else lua.lua_pushliteral(L, ""); return 1; }; diff --git a/src/lutf8lib.js b/src/lutf8lib.js index a35de63..e78b8e8 100644 --- a/src/lutf8lib.js +++ b/src/lutf8lib.js @@ -1,7 +1,6 @@ "use strict"; const lua = require('./lua.js'); -const lapi = require('./lapi.js'); const lauxlib = require('./lauxlib.js'); const llimit = require('./llimit.js'); @@ -60,7 +59,6 @@ const utf8_decode = function(s, val) { const utflen = function(L) { let n = 0; let s = lauxlib.luaL_checkstring(L, 1); - s = L.stack[lapi.index2addr_(L, 1)].value; let len = s.length; let posi = u_posrelat(lauxlib.luaL_optinteger(L, 2, 1), len); let posj = u_posrelat(lauxlib.luaL_optinteger(L, 3, -1), len); @@ -115,7 +113,6 @@ const utfchar = function(L) { */ const byteoffset = function(L) { let s = lauxlib.luaL_checkstring(L, 1); - s = L.stack[lapi.index2addr_(L, 1)].value; let n = lauxlib.luaL_checkinteger(L, 2); let posi = n >= 0 ? 1 : s.length + 1; posi = u_posrelat(lauxlib.luaL_optinteger(L, 3, posi), s.length); @@ -161,7 +158,6 @@ const byteoffset = function(L) { */ const codepoint = function(L) { let s = lauxlib.luaL_checkstring(L, 1); - s = L.stack[lapi.index2addr_(L, 1)].value; let posi = u_posrelat(lauxlib.luaL_optinteger(L, 2, 1), s.length); let pose = u_posrelat(lauxlib.luaL_optinteger(L, 3, posi), s.length); @@ -188,7 +184,6 @@ const codepoint = function(L) { const iter_aux = function(L) { let s = lauxlib.luaL_checkstring(L, 1); - s = L.stack[lapi.index2addr_(L, 1)].value; let len = s.length; let n = lua.lua_tointeger(L, 2) - 1; |