diff options
Diffstat (limited to 'lapi.c')
-rw-r--r-- | lapi.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -368,6 +368,18 @@ LUA_API int lua_compare (lua_State *L, int index1, int index2, int op) { | |||
368 | } | 368 | } |
369 | 369 | ||
370 | 370 | ||
371 | LUA_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 | |||
371 | LUA_API size_t lua_stringtonumber (lua_State *L, const char *s) { | 383 | LUA_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) |