aboutsummaryrefslogtreecommitdiff
path: root/lvm.c
diff options
context:
space:
mode:
Diffstat (limited to 'lvm.c')
-rw-r--r--lvm.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/lvm.c b/lvm.c
index 62060d90..fe2dc851 100644
--- a/lvm.c
+++ b/lvm.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lvm.c,v 1.59 1999/08/10 12:55:47 roberto Exp roberto $ 2** $Id: lvm.c,v 1.60 1999/08/16 20:52:00 roberto Exp roberto $
3** Lua virtual machine 3** Lua virtual machine
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -53,21 +53,8 @@ int luaV_tonumber (TObject *obj) { /* LUA_NUMBER */
53 if (ttype(obj) != LUA_T_STRING) 53 if (ttype(obj) != LUA_T_STRING)
54 return 1; 54 return 1;
55 else { 55 else {
56 real t; 56 if (!luaO_str2d(svalue(obj), &nvalue(obj)))
57 char *e = svalue(obj);
58 int sig = 1;
59 while (isspace((unsigned char)*e)) e++;
60 if (*e == '-') {
61 e++;
62 sig = -1;
63 }
64 else if (*e == '+') e++;
65 /* no digit before or after decimal point? */
66 if (!isdigit((unsigned char)*e) && !isdigit((unsigned char)*(e+1)))
67 return 2; 57 return 2;
68 t = (real)luaO_str2d(e);
69 if (t<0) return 2;
70 nvalue(obj) = t*sig;
71 ttype(obj) = LUA_T_NUMBER; 58 ttype(obj) = LUA_T_NUMBER;
72 return 0; 59 return 0;
73 } 60 }