diff options
author | daurnimator <quae@daurnimator.com> | 2017-12-13 14:55:33 +1100 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2017-12-13 15:31:04 +1100 |
commit | 11a2421acaf2b39d19ee99933102c35e28fd13f8 (patch) | |
tree | 4abd1fa6ee063f75c634349a02702de7bc145a8b /src/lauxlib.js | |
parent | 3e7c102eefbaae9e6bc839b11bba79aee1c5e040 (diff) | |
download | fengari-11a2421acaf2b39d19ee99933102c35e28fd13f8.tar.gz fengari-11a2421acaf2b39d19ee99933102c35e28fd13f8.tar.bz2 fengari-11a2421acaf2b39d19ee99933102c35e28fd13f8.zip |
Use Uint8Array to back strings
Diffstat (limited to 'src/lauxlib.js')
-rw-r--r-- | src/lauxlib.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lauxlib.js b/src/lauxlib.js index b9b7078..6acf57f 100644 --- a/src/lauxlib.js +++ b/src/lauxlib.js @@ -381,14 +381,14 @@ const luaL_prepbuffer = function(B) { }; const luaL_addlstring = function(B, s, l) { - B.b = B.b.concat(s.slice(0, l)); + B.b = B.b.concat(Array.from(s.subarray(0, l))); }; const luaL_addstring = luaL_addlstring; const luaL_pushresult = function(B) { let L = B.L; - lua.lua_pushstring(L, B.b); + lua.lua_pushstring(L, Uint8Array.from(B.b)); }; const luaL_addchar = function(B, c) { @@ -558,7 +558,7 @@ const luaL_gsub = function(L, s, p, r) { s = s.slice(wild + p.length); /* continue after 'p' */ } b.push(...s); /* push last suffix */ - lua.lua_pushstring(L, b); + lua.lua_pushstring(L, Uint8Array.from(b)); return lua.lua_tostring(L, -1); }; |