summaryrefslogtreecommitdiff
path: root/src/lapi.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2018-01-07 03:28:43 +1100
committerdaurnimator <quae@daurnimator.com>2018-01-07 03:35:03 +1100
commitef0784b2982e65af05982d8e1e18ef1d45ea96ad (patch)
tree0cc5a7aff5c54c7dae8f2fa84dc4f32a131e47bf /src/lapi.js
parenta63de72aa0bf0b1b3bd91ed0c23c4d03bcbf4cd5 (diff)
downloadfengari-ef0784b2982e65af05982d8e1e18ef1d45ea96ad.tar.gz
fengari-ef0784b2982e65af05982d8e1e18ef1d45ea96ad.tar.bz2
fengari-ef0784b2982e65af05982d8e1e18ef1d45ea96ad.zip
Avoid Uint8Array.slice (IE compat)
Diffstat (limited to 'src/lapi.js')
-rw-r--r--src/lapi.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lapi.js b/src/lapi.js
index b42ad92..4836e12 100644
--- a/src/lapi.js
+++ b/src/lapi.js
@@ -235,12 +235,12 @@ const lua_pushlstring = function(L, s, len) {
let ts;
if (len === 0) {
s = defs.to_luastring("", true);
+ ts = lstring.luaS_bless(L, s);
} else {
s = defs.from_userstring(s);
assert(s.length >= len, "invalid length to lua_pushlstring");
- s = s.slice(0, len);
+ ts = lstring.luaS_new(L, s.subarray(0, len));
}
- ts = lstring.luaS_bless(L, s);
lobject.pushsvalue2s(L, ts);
assert(L.top <= L.ci.top, "stack overflow");