summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lauxlib.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lauxlib.js b/src/lauxlib.js
index 23cd041..3019bf3 100644
--- a/src/lauxlib.js
+++ b/src/lauxlib.js
@@ -791,12 +791,12 @@ if (!WEB) {
}
try {
- let com;
- if ((com = skipcomment(lf)).skipped) /* read initial portion */
- lf.buff[lf.n++] = '\n'.charCodeAt(0); /* add line to correct line numbers */
-
+ let com = skipcomment(lf);
+ /* check for signature first, as we don't want to add line number corrections in binary case */
if (com.c === lua.LUA_SIGNATURE.charCodeAt(0) && filename) { /* binary file? */
lf.binary = true;
+ } else if (com.skipped) { /* read initial portion */
+ lf.buff[lf.n++] = '\n'.charCodeAt(0); /* add line to correct line numbers */
}
if (com.c !== null)
lf.buff[lf.n++] = com.c; /* 'c' is the first character of the stream */