From a9dc7c88283a8046ad40c592f9e626d93e8e14a1 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy <roberto@inf.puc-rio.br> Date: Fri, 2 Jul 2010 14:35:06 -0300 Subject: functions lua_tonumber/lua_tointeger replaced by lua_tonumberx/lua_tointegerx that have an extra out parameter with conversion status --- lbitlib.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lbitlib.c') diff --git a/lbitlib.c b/lbitlib.c index cae1b1f5..21cf95b6 100644 --- a/lbitlib.c +++ b/lbitlib.c @@ -1,5 +1,5 @@ /* -** $Id: lbitlib.c,v 1.4 2010/02/11 15:55:29 roberto Exp roberto $ +** $Id: lbitlib.c,v 1.5 2010/07/02 11:38:13 roberto Exp roberto $ ** Standard library for bitwise operations ** See Copyright Notice in lua.h */ @@ -23,8 +23,9 @@ typedef unsigned LUA_INT32 b_uint; static b_uint getuintarg (lua_State *L, int arg) { b_uint r; - lua_Number x = lua_tonumber(L, arg); - if (x == 0) luaL_checktype(L, arg, LUA_TNUMBER); + int isnum; + lua_Number x = lua_tonumberx(L, arg, &isnum); + if (!isnum) luaL_typeerror(L, arg, "number"); lua_number2uint(r, x); return r; } -- cgit v1.2.3-55-g6feb