aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2018-03-26 00:15:36 +1100
committerdaurnimator <quae@daurnimator.com>2018-03-26 00:15:36 +1100
commita923f0700911ee20ae46c4b5c310d03ff8657b6d (patch)
tree788de47207270344a3ce41f49563db488e4fa22f /src
parent67a968f94e0b268c11d05aac79b9efd6fa018e10 (diff)
downloadfengari-a923f0700911ee20ae46c4b5c310d03ff8657b6d.tar.gz
fengari-a923f0700911ee20ae46c4b5c310d03ff8657b6d.tar.bz2
fengari-a923f0700911ee20ae46c4b5c310d03ff8657b6d.zip
src/luaconf.js: Use env var FENGARICONF for configuration
Diffstat (limited to 'src')
-rw-r--r--src/luaconf.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/luaconf.js b/src/luaconf.js
index 84cf354..424d4ea 100644
--- a/src/luaconf.js
+++ b/src/luaconf.js
@@ -1,12 +1,14 @@
"use strict";
+const conf = (process.env.FENGARICONF ? JSON.parse(process.env.FENGARICONF) : {});
+
/*
@@ LUA_COMPAT_FLOATSTRING makes Lua format integral floats without a
@@ a float mark ('.0').
** This macro is not on by default even in compatibility mode,
** because this is not really an incompatibility.
*/
-const LUA_COMPAT_FLOATSTRING = false;
+const LUA_COMPAT_FLOATSTRING = conf.LUA_COMPAT_FLOATSTRING || false;
const LUA_MAXINTEGER = 2147483647;
const LUA_MININTEGER = -2147483648;
@@ -18,14 +20,14 @@ const LUA_MININTEGER = -2147483648;
** space (and to reserve some numbers for pseudo-indices).
*/
/* TODO: put back to 1000000. Node would go out of memory in some cases (e.g. travis) */
-const LUAI_MAXSTACK = 100000;
+const LUAI_MAXSTACK = conf.LUAI_MAXSTACK || 100000;
/*
@@ LUA_IDSIZE gives the maximum size for the description of the source
@@ of a function in debug information.
** CHANGE it if you want a different size.
*/
-const LUA_IDSIZE = 60-1; /* fengari uses 1 less than lua as we don't embed the null byte */
+const LUA_IDSIZE = conf.LUA_IDSIZE || (60-1); /* fengari uses 1 less than lua as we don't embed the null byte */
const lua_integer2str = function(n) {
return String(n); /* should match behaviour of LUA_INTEGER_FMT */
@@ -56,7 +58,7 @@ const luai_apicheck = function(l, e) {
/*
@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system.
*/
-const LUAL_BUFFERSIZE = 8192;
+const LUAL_BUFFERSIZE = conf.LUAL_BUFFERSIZE || 8192;
// See: http://croquetweak.blogspot.fr/2014/08/deconstructing-floats-frexp-and-ldexp.html
const frexp = function(value) {