summaryrefslogtreecommitdiff
path: root/src/luaconf.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann@users.noreply.github.com>2017-05-22 20:06:57 +0200
committerGitHub <noreply@github.com>2017-05-22 20:06:57 +0200
commite3bdd1fea3665df28de25ed76f6399faf957179d (patch)
tree6884757b43064fa7163b54b86aa4561d185b5ca2 /src/luaconf.js
parent25e2110a5eac0a2e6c7b4d502ffbd53fc61af301 (diff)
parent8a439e5563f12335e3d35dd63b4f8cbcc25a9bd8 (diff)
downloadfengari-e3bdd1fea3665df28de25ed76f6399faf957179d.tar.gz
fengari-e3bdd1fea3665df28de25ed76f6399faf957179d.tar.bz2
fengari-e3bdd1fea3665df28de25ed76f6399faf957179d.zip
Merge pull request #63 from daurnimator/fix-skipped-tests
Investigated + fixed some skipped tests
Diffstat (limited to 'src/luaconf.js')
-rw-r--r--src/luaconf.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/luaconf.js b/src/luaconf.js
index 3d0d18f..c272178 100644
--- a/src/luaconf.js
+++ b/src/luaconf.js
@@ -2,6 +2,7 @@
"use strict";
const llimit = require('./llimit.js');
+const sprintf = require('sprintf-js').sprintf;
/*
@@ LUAI_MAXSTACK limits the size of the Lua stack.
@@ -18,6 +19,14 @@ const LUAI_MAXSTACK = 1000000;
*/
const LUA_IDSIZE = 60;
+const lua_integer2str = function(n) {
+ return sprintf(LUA_INTEGER_FMT, n);
+};
+
+const lua_number2str = function(n) {
+ return sprintf(LUA_NUMBER_FMT, n);
+};
+
const lua_numbertointeger = function(n) {
return n >= llimit.MIN_INT && n < -llimit.MIN_INT ? n : false;
};
@@ -64,4 +73,6 @@ module.exports.LUA_INTEGER_FRMLEN = LUA_INTEGER_FRMLEN;
module.exports.LUA_NUMBER_FMT = LUA_NUMBER_FMT;
module.exports.LUA_NUMBER_FRMLEN = LUA_NUMBER_FRMLEN;
module.exports.lua_getlocaledecpoint = lua_getlocaledecpoint;
+module.exports.lua_integer2str = lua_integer2str;
+module.exports.lua_number2str = lua_number2str;
module.exports.lua_numbertointeger = lua_numbertointeger;