diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1994-11-22 14:02:53 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1994-11-22 14:02:53 -0200 |
commit | 577ae944e9415032410da56e648b7535620b61f5 (patch) | |
tree | 89f5fa12ebc7e5121067351d9844c77ed72d8e89 | |
parent | 68d1091b7996d4e1b40fe43f4bcae2e7594ab806 (diff) | |
download | lua-577ae944e9415032410da56e648b7535620b61f5.tar.gz lua-577ae944e9415032410da56e648b7535620b61f5.tar.bz2 lua-577ae944e9415032410da56e648b7535620b61f5.zip |
correction of function tonumber
-rw-r--r-- | opcode.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -3,7 +3,7 @@ | |||
3 | ** TecCGraf - PUC-Rio | 3 | ** TecCGraf - PUC-Rio |
4 | */ | 4 | */ |
5 | 5 | ||
6 | char *rcs_opcode="$Id: opcode.c,v 3.19 1994/11/21 13:30:15 roberto Exp $"; | 6 | char *rcs_opcode="$Id: opcode.c,v 3.20 1994/11/21 18:22:58 roberto Exp roberto $"; |
7 | 7 | ||
8 | #include <setjmp.h> | 8 | #include <setjmp.h> |
9 | #include <stdio.h> | 9 | #include <stdio.h> |
@@ -138,9 +138,10 @@ static char *lua_strconc (char *l, char *r) | |||
138 | static int lua_tonumber (Object *obj) | 138 | static int lua_tonumber (Object *obj) |
139 | { | 139 | { |
140 | float t; | 140 | float t; |
141 | char c; | ||
141 | if (tag(obj) != LUA_T_STRING) | 142 | if (tag(obj) != LUA_T_STRING) |
142 | return 1; | 143 | return 1; |
143 | else if (sscanf(svalue(obj), "%f %*c",&t) == 1) | 144 | else if (sscanf(svalue(obj), "%f %c",&t, &c) == 1) |
144 | { | 145 | { |
145 | nvalue(obj) = t; | 146 | nvalue(obj) = t; |
146 | tag(obj) = LUA_T_NUMBER; | 147 | tag(obj) = LUA_T_NUMBER; |