diff options
Diffstat (limited to 'src/lapi.js')
-rw-r--r-- | src/lapi.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lapi.js b/src/lapi.js index bc4dd54..19e3090 100644 --- a/src/lapi.js +++ b/src/lapi.js @@ -488,6 +488,13 @@ const lua_topointer = function(L, idx) { } }; +const lua_stringtonumber = function(L, s) { + let number = parseFloat(s); + L.stack[L.top++] = new TValue(number % 1 !== 0 ? CT.LUA_TNUMFLT : CT.LUA_TNUMINT, number); + assert(L.top <= L.ci.top, "stack overflow"); + return s.length; +}; + const f_call = function(L, ud) { ldo.luaD_callnoyield(L, ud.funcOff, ud.nresults); }; @@ -705,4 +712,5 @@ module.exports.lua_error = lua_error; module.exports.lua_insert = lua_insert; module.exports.lua_gc = lua_gc; module.exports.lua_getallocf = lua_getallocf; -module.exports.lua_getextraspace = lua_getextraspace;
\ No newline at end of file +module.exports.lua_getextraspace = lua_getextraspace; +module.exports.lua_stringtonumber = lua_stringtonumber;
\ No newline at end of file |