aboutsummaryrefslogtreecommitdiff
path: root/lapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'lapi.c')
-rw-r--r--lapi.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/lapi.c b/lapi.c
index fffd7d26..631cf44e 100644
--- a/lapi.c
+++ b/lapi.c
@@ -368,6 +368,18 @@ LUA_API int lua_compare (lua_State *L, int index1, int index2, int op) {
368} 368}
369 369
370 370
371LUA_API unsigned (lua_numbertostrbuff) (lua_State *L, int idx, char *buff) {
372 const TValue *o = index2value(L, idx);
373 if (ttisnumber(o)) {
374 unsigned len = luaO_tostringbuff(o, buff);
375 buff[len++] = '\0'; /* add final zero */
376 return len;
377 }
378 else
379 return 0;
380}
381
382
371LUA_API size_t lua_stringtonumber (lua_State *L, const char *s) { 383LUA_API size_t lua_stringtonumber (lua_State *L, const char *s) {
372 size_t sz = luaO_str2num(s, s2v(L->top.p)); 384 size_t sz = luaO_str2num(s, s2v(L->top.p));
373 if (sz != 0) 385 if (sz != 0)