summaryrefslogtreecommitdiff
path: root/src/lobject.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-03-21 15:29:53 +0100
committerBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-03-23 08:28:07 +0100
commit9e08fa3a4b9f8848bb4eac3e745079282099a3d8 (patch)
tree64be88a45075fe93bbd8c03c3244d3a83fad7491 /src/lobject.js
parentc4b23126f0cb803ec944c5d7877bbf669f582374 (diff)
downloadfengari-9e08fa3a4b9f8848bb4eac3e745079282099a3d8.tar.gz
fengari-9e08fa3a4b9f8848bb4eac3e745079282099a3d8.tar.bz2
fengari-9e08fa3a4b9f8848bb4eac3e745079282099a3d8.zip
loadfile
Diffstat (limited to 'src/lobject.js')
-rw-r--r--src/lobject.js7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/lobject.js b/src/lobject.js
index dfe6337..8fc587d 100644
--- a/src/lobject.js
+++ b/src/lobject.js
@@ -119,7 +119,6 @@ class TValue {
}
jsstring() {
- //return this.ttisstring() ? String.fromCharCode(...this.value) : null;
let u0, u1, u2, u3, u4, u5;
let idx = 0;
@@ -273,17 +272,17 @@ const PRE = "[string \"";
const POS = "\"]";
const luaO_chunkid = function(source, bufflen) {
- source = source instanceof TValue ? source.value : source;
+ source = source instanceof TValue ? source.jsstring() : source;
bufflen = bufflen instanceof TValue ? bufflen.value : bufflen;
let l = source.length;
let out = "";
- if (source[0] === '=') { /* 'literal' source */
+ if (source.charAt(0) === '=') { /* 'literal' source */
if (l < bufflen) /* small enough? */
out = `${source.slice(1)}`;
else { /* truncate it */
out += `${source.slice(1, bufflen)}`;
}
- } else if (source[0] === '@') { /* file name */
+ } else if (source.charAt(0) === '@') { /* file name */
if (l <= bufflen) /* small enough? */
out = `${source.slice(1)}`;
else { /* add '...' before rest of name */