diff options
author | daurnimator <quae@daurnimator.com> | 2017-05-22 23:11:34 +1000 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2017-05-23 00:52:01 +1000 |
commit | b525c305b524f5b3ffaba3187ccc828d332aa835 (patch) | |
tree | c6d3f0c16f912e0aa5cbe24a980385337a40bd40 /src/luaconf.js | |
parent | 7d849c2df476c92a09ed4067117b5d5e3d5d988e (diff) | |
download | fengari-b525c305b524f5b3ffaba3187ccc828d332aa835.tar.gz fengari-b525c305b524f5b3ffaba3187ccc828d332aa835.tar.bz2 fengari-b525c305b524f5b3ffaba3187ccc828d332aa835.zip |
src/luaconf.js: Implement lua_integer2str and lua_number2str
Diffstat (limited to 'src/luaconf.js')
-rw-r--r-- | src/luaconf.js | 11 |
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; |