'lua_strtonum' (and 'luaO_str2num') now return string size, instead of

receiving it
This commit is contained in:
Roberto Ierusalimschy
2014-05-01 15:18:06 -03:00
parent ddff6ecf30
commit c549d4fe64
7 changed files with 39 additions and 41 deletions

12
lapi.c
View File

@@ -1,5 +1,5 @@
/*
** $Id: lapi.c,v 2.206 2014/04/29 18:14:16 roberto Exp roberto $
** $Id: lapi.c,v 2.207 2014/04/30 16:48:44 roberto Exp roberto $
** Lua API
** See Copyright Notice in lua.h
*/
@@ -333,13 +333,11 @@ LUA_API int lua_compare (lua_State *L, int index1, int index2, int op) {
}
LUA_API int lua_strtonum (lua_State *L, const char *s, size_t len) {
if (!luaO_str2num(s, len, L->top))
return 0; /* conversion failed */
else {
LUA_API size_t lua_strtonum (lua_State *L, const char *s) {
size_t sz = luaO_str2num(s, L->top);
if (sz != 0)
api_incr_top(L);
return 1;
}
return sz;
}