summaryrefslogtreecommitdiff
path: root/src/lobject.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2018-01-07 02:52:40 +1100
committerdaurnimator <quae@daurnimator.com>2018-01-07 03:34:56 +1100
commite46d3e7d8d7226d49aad05f5a9c639c77d53bb04 (patch)
treefe3e99cbfce31d7d3495c0f861cbdc0aad67167a /src/lobject.js
parent6ffe07fc5d16ee9acdcd6651d433ce13b193cd15 (diff)
downloadfengari-e46d3e7d8d7226d49aad05f5a9c639c77d53bb04.tar.gz
fengari-e46d3e7d8d7226d49aad05f5a9c639c77d53bb04.tar.bz2
fengari-e46d3e7d8d7226d49aad05f5a9c639c77d53bb04.zip
Introduce luastring_indexOf as Uint8Array.indexOf doesn't exist everywhere
Diffstat (limited to 'src/lobject.js')
-rw-r--r--src/lobject.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lobject.js b/src/lobject.js
index b5d4a96..384facd 100644
--- a/src/lobject.js
+++ b/src/lobject.js
@@ -318,7 +318,7 @@ const luaO_chunkid = function(source, bufflen) {
}
} else { /* string; format as [string "source"] */
out = new Uint8Array(bufflen);
- let nli = source.indexOf(char['\n']); /* find first new line (if any) */
+ let nli = defs.luastring_indexOf(source, char['\n']); /* find first new line (if any) */
out.set(PRE); /* add prefix */
let out_i = PRE.length;
bufflen -= PRE.length + RETS.length + POS.length; /* save space for prefix+suffix */
@@ -539,7 +539,7 @@ const luaO_pushvfstring = function(L, fmt, argp) {
let a = 0;
let e;
for (;;) {
- e = fmt.indexOf(char['%'], i);
+ e = defs.luastring_indexOf(fmt, char['%'], i);
if (e == -1) break;
pushstr(L, fmt.subarray(i, e));
switch(fmt[e+1]) {
@@ -549,7 +549,7 @@ const luaO_pushvfstring = function(L, fmt, argp) {
else {
s = defs.from_userstring(s);
/* respect null terminator */
- let i = s.indexOf(0);
+ let i = defs.luastring_indexOf(s, 0);
if (i !== -1)
s = s.subarray(0, i);
}