diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-04-13 15:08:18 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-04-13 15:08:18 -0300 |
| commit | d76b1a0eefc51384c75ffc0b847c212ad98f20f8 (patch) | |
| tree | 0fd896fc6b9ba2f16f476b7310a5c781cf38e2b3 | |
| parent | e7c8393682f2977742cdac359cce9e558318aeac (diff) | |
| download | lua-d76b1a0eefc51384c75ffc0b847c212ad98f20f8.tar.gz lua-d76b1a0eefc51384c75ffc0b847c212ad98f20f8.tar.bz2 lua-d76b1a0eefc51384c75ffc0b847c212ad98f20f8.zip | |
`base' for `tonumber' must be >= 2.
| -rw-r--r-- | lbuiltin.c | 4 |
1 files changed, 2 insertions, 2 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lbuiltin.c,v 1.102 2000/04/04 20:49:32 roberto Exp roberto $ | 2 | ** $Id: lbuiltin.c,v 1.103 2000/04/13 16:46:43 roberto Exp roberto $ |
| 3 | ** Built-in functions | 3 | ** Built-in functions |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -166,7 +166,7 @@ void luaB_tonumber (lua_State *L) { | |||
| 166 | const char *s1 = luaL_check_string(L, 1); | 166 | const char *s1 = luaL_check_string(L, 1); |
| 167 | char *s2; | 167 | char *s2; |
| 168 | Number n; | 168 | Number n; |
| 169 | luaL_arg_check(L, 0 <= base && base <= 36, 2, "base out of range"); | 169 | luaL_arg_check(L, 2 <= base && base <= 36, 2, "base out of range"); |
| 170 | n = strtoul(s1, &s2, base); | 170 | n = strtoul(s1, &s2, base); |
| 171 | if (s1 != s2) { /* at least one valid digit? */ | 171 | if (s1 != s2) { /* at least one valid digit? */ |
| 172 | while (isspace((unsigned char)*s2)) s2++; /* skip trailing spaces */ | 172 | while (isspace((unsigned char)*s2)) s2++; /* skip trailing spaces */ |
