functions lua_tonumber/lua_tointeger replaced by lua_tonumberx/lua_tointegerx

that have an extra out parameter with conversion status
This commit is contained in:
Roberto Ierusalimschy
2010-07-02 14:35:06 -03:00
parent 7192afafee
commit a9dc7c8828
5 changed files with 37 additions and 24 deletions

9
lua.h
View File

@@ -1,5 +1,5 @@
/*
** $Id: lua.h,v 1.269 2010/05/10 13:50:20 roberto Exp roberto $
** $Id: lua.h,v 1.270 2010/05/12 14:09:20 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
@@ -153,8 +153,8 @@ LUA_API int (lua_isuserdata) (lua_State *L, int idx);
LUA_API int (lua_type) (lua_State *L, int idx);
LUA_API const char *(lua_typename) (lua_State *L, int tp);
LUA_API lua_Number (lua_tonumber) (lua_State *L, int idx);
LUA_API lua_Integer (lua_tointeger) (lua_State *L, int idx);
LUA_API lua_Number (lua_tonumberx) (lua_State *L, int idx, int *isnum);
LUA_API lua_Integer (lua_tointegerx) (lua_State *L, int idx, int *isnum);
LUA_API int (lua_toboolean) (lua_State *L, int idx);
LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len);
LUA_API size_t (lua_rawlen) (lua_State *L, int idx);
@@ -296,6 +296,9 @@ LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud);
** ===============================================================
*/
#define lua_tonumber(L,i) lua_tonumberx(L,i,NULL)
#define lua_tointeger(L,i) lua_tointegerx(L,i,NULL)
#define lua_pop(L,n) lua_settop(L, -(n)-1)
#define lua_newtable(L) lua_createtable(L, 0, 0)