aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2018-04-02 13:43:53 +1000
committerdaurnimator <quae@daurnimator.com>2018-04-02 13:46:01 +1000
commit7b81adb41b049ca968217de349f6ed0814ba0b27 (patch)
tree6a35d57844af73df97733389a930e4cebc384cf6 /src
parent39ca3a54682f023afae87e2e307fd18fdde20b57 (diff)
downloadfengari-7b81adb41b049ca968217de349f6ed0814ba0b27.tar.gz
fengari-7b81adb41b049ca968217de349f6ed0814ba0b27.tar.bz2
fengari-7b81adb41b049ca968217de349f6ed0814ba0b27.zip
src/lauxlib.js: Use a Buffer in luaL_loadfilex for node 6 compat
Diffstat (limited to 'src')
-rw-r--r--src/lauxlib.js28
1 files changed, 19 insertions, 9 deletions
diff --git a/src/lauxlib.js b/src/lauxlib.js
index 74e83e8..d575e99 100644
--- a/src/lauxlib.js
+++ b/src/lauxlib.js
@@ -810,17 +810,17 @@ const skipcomment = function(lf) {
let luaL_loadfilex;
-class LoadF {
- constructor() {
- this.n = NaN; /* number of pre-read characters */
- this.f = null; /* file being read */
- this.buff = new Uint8Array(1024); /* area for reading file */
- this.pos = 0; /* current position in file */
- this.err = void 0;
+if (typeof process === "undefined") {
+ class LoadF {
+ constructor() {
+ this.n = NaN; /* number of pre-read characters */
+ this.f = null; /* file being read */
+ this.buff = new Uint8Array(1024); /* area for reading file */
+ this.pos = 0; /* current position in file */
+ this.err = void 0;
+ }
}
-}
-if (typeof process === "undefined") {
const getF = function(L, ud) {
let lf = ud;
@@ -889,6 +889,16 @@ if (typeof process === "undefined") {
} else {
const fs = require('fs');
+ class LoadF {
+ constructor() {
+ this.n = NaN; /* number of pre-read characters */
+ this.f = null; /* file being read */
+ this.buff = Buffer.alloc(1024); /* area for reading file */
+ this.pos = 0; /* current position in file */
+ this.err = void 0;
+ }
+ }
+
const getF = function(L, ud) {
let lf = ud;
let bytes = 0;