summaryrefslogtreecommitdiff
path: root/lapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'lapi.c')
-rw-r--r--lapi.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/lapi.c b/lapi.c
index 5b866885..a81d3ecc 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 2.205 2014/04/15 16:32:49 roberto Exp roberto $ 2** $Id: lapi.c,v 2.206 2014/04/29 18:14:16 roberto Exp roberto $
3** Lua API 3** Lua API
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -334,17 +334,12 @@ LUA_API int lua_compare (lua_State *L, int index1, int index2, int op) {
334 334
335 335
336LUA_API int lua_strtonum (lua_State *L, const char *s, size_t len) { 336LUA_API int lua_strtonum (lua_State *L, const char *s, size_t len) {
337 lua_Integer i; lua_Number n; 337 if (!luaO_str2num(s, len, L->top))
338 if (luaO_str2int(s, len, &i)) { /* try as an integer */
339 setivalue(L->top, i);
340 }
341 else if (luaO_str2d(s, len, &n)) { /* else try as a float */
342 setfltvalue(L->top, n);
343 }
344 else
345 return 0; /* conversion failed */ 338 return 0; /* conversion failed */
346 api_incr_top(L); 339 else {
347 return 1; 340 api_incr_top(L);
341 return 1;
342 }
348} 343}
349 344
350 345