From 2b83711fbac0509a40cfb616b9a68bdf683e8471 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 19 Dec 2014 11:36:32 -0200 Subject: new macro 'nvalue' (to convert an object to a float when we know object is a number) --- lvm.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lvm.c') diff --git a/lvm.c b/lvm.c index 5e7764bd..8944da01 100644 --- a/lvm.c +++ b/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 -- cgit v1.2.3-55-g6feb