aboutsummaryrefslogtreecommitdiff
path: root/src/lstrlib.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/lstrlib.js')
-rw-r--r--src/lstrlib.js5
1 files changed, 1 insertions, 4 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;
};