new macro 'nvalue' (to convert an object to a float when we know
object is a number)
This commit is contained in:
5
lvm.c
5
lvm.c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lvm.c,v 2.229 2014/11/19 15:05:15 roberto Exp roberto $
|
||||
** $Id: lvm.c,v 2.230 2014/11/21 12:15:00 roberto Exp roberto $
|
||||
** Lua virtual machine
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@@ -74,8 +74,7 @@ int luaV_tonumber_ (const TValue *obj, lua_Number *n) {
|
||||
}
|
||||
else if (cvt2num(obj) && /* string convertible to number? */
|
||||
luaO_str2num(svalue(obj), &v) == tsvalue(obj)->len + 1) {
|
||||
/* convert result of 'luaO_str2num' to a float */
|
||||
*n = (ttisinteger(&v)) ? cast_num(ivalue(&v)) : fltvalue(&v);
|
||||
*n = nvalue(&v); /* convert result of 'luaO_str2num' to a float */
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user