lua

A copy of the Lua development repository
Log | Files | Refs | README

commit f8daddba506112cafdc980a4935e46cf358e37c1
parent e58ef8d0bbd2f4fc873cd40218922f9a25de4c2e
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Wed, 14 May 2014 16:46:46 -0300

added a compat option (although it will be off by default) to
the addition of '.0' to float->string conversions

Diffstat:
Mlvm.c | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lvm.c b/lvm.c @@ -1,5 +1,5 @@ /* -** $Id: lvm.c,v 2.208 2014/05/12 21:22:05 roberto Exp roberto $ +** $Id: lvm.c,v 2.209 2014/05/12 21:44:17 roberto Exp roberto $ ** Lua virtual machine ** See Copyright Notice in lua.h */ @@ -140,10 +140,12 @@ int luaV_tostring (lua_State *L, StkId obj) { len = lua_integer2str(buff, ivalue(obj)); else { len = lua_number2str(buff, fltvalue(obj)); +#if !defined(LUA_COMPAT_FLOATSTRING) if (buff[strspn(buff, "-0123456789")] == '\0') { /* looks like an int? */ buff[len++] = '.'; buff[len++] = '0'; /* adds '.0' to result */ } +#endif } setsvalue2s(L, obj, luaS_newlstr(L, buff, len)); return 1;