mirror of
https://github.com/lua/lua
synced 2024-11-22 12:51:30 +03:00
'lua_stringtonum' -> 'lua_stringtonumber'
This commit is contained in:
parent
f97c64d7bf
commit
0d31efb365
4
lapi.c
4
lapi.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lapi.c,v 2.236 2014/10/07 18:29:13 roberto Exp roberto $
|
||||
** $Id: lapi.c,v 2.237 2014/10/15 14:27:40 roberto Exp roberto $
|
||||
** Lua API
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -332,7 +332,7 @@ LUA_API int lua_compare (lua_State *L, int index1, int index2, int op) {
|
||||
}
|
||||
|
||||
|
||||
LUA_API size_t lua_stringtonum (lua_State *L, const char *s) {
|
||||
LUA_API size_t lua_stringtonumber (lua_State *L, const char *s) {
|
||||
size_t sz = luaO_str2num(s, L->top);
|
||||
if (sz != 0)
|
||||
api_incr_top(L);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lbaselib.c,v 1.301 2014/10/15 14:27:40 roberto Exp roberto $
|
||||
** $Id: lbaselib.c,v 1.302 2014/10/17 16:28:21 roberto Exp roberto $
|
||||
** Basic library
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -77,7 +77,7 @@ static int luaB_tonumber (lua_State *L) {
|
||||
else {
|
||||
size_t l;
|
||||
const char *s = lua_tolstring(L, 1, &l);
|
||||
if (s != NULL && lua_stringtonum(L, s) == l + 1)
|
||||
if (s != NULL && lua_stringtonumber(L, s) == l + 1)
|
||||
return 1; /* successful conversion to number */
|
||||
/* else not a number */
|
||||
}
|
||||
|
8
liolib.c
8
liolib.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: liolib.c,v 2.132 2014/10/15 14:27:40 roberto Exp roberto $
|
||||
** $Id: liolib.c,v 2.133 2014/10/17 16:28:21 roberto Exp roberto $
|
||||
** Standard I/O (and system) library
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -425,8 +425,8 @@ static int readdigits (RN *rn, int hex) {
|
||||
|
||||
/*
|
||||
** Read a number: first reads a valid prefix of a numeral into a buffer.
|
||||
** Then it calls 'lua_stringtonum' to check whether the format is correct
|
||||
** and to convert it to a Lua number
|
||||
** Then it calls 'lua_stringtonumber' to check whether the format is
|
||||
** correct and to convert it to a Lua number
|
||||
*/
|
||||
static int read_number (lua_State *L, FILE *f) {
|
||||
RN rn;
|
||||
@ -452,7 +452,7 @@ static int read_number (lua_State *L, FILE *f) {
|
||||
ungetc(rn.c, rn.f); /* unread look-ahead char */
|
||||
l_unlockfile(rn.f);
|
||||
rn.buff[rn.n] = '\0'; /* finish string */
|
||||
if (lua_stringtonum(L, rn.buff)) /* is this a valid number? */
|
||||
if (lua_stringtonumber(L, rn.buff)) /* is this a valid number? */
|
||||
return 1; /* ok */
|
||||
else { /* invalid format */
|
||||
lua_pushnil(L); /* "result" to be removed */
|
||||
|
4
lua.h
4
lua.h
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lua.h,v 1.317 2014/10/07 18:29:13 roberto Exp roberto $
|
||||
** $Id: lua.h,v 1.318 2014/10/15 14:27:40 roberto Exp roberto $
|
||||
** Lua - A Scripting Language
|
||||
** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
|
||||
** See Copyright Notice at the end of this file
|
||||
@ -321,7 +321,7 @@ LUA_API int (lua_next) (lua_State *L, int idx);
|
||||
LUA_API void (lua_concat) (lua_State *L, int n);
|
||||
LUA_API void (lua_len) (lua_State *L, int idx);
|
||||
|
||||
LUA_API size_t (lua_stringtonum) (lua_State *L, const char *s);
|
||||
LUA_API size_t (lua_stringtonumber) (lua_State *L, const char *s);
|
||||
|
||||
LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud);
|
||||
LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud);
|
||||
|
Loading…
Reference in New Issue
Block a user