diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-07-05 11:39:15 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-07-05 11:39:15 -0300 |
commit | 2b4bd21585c15a25fdf7dee6ae7a4fc98916112a (patch) | |
tree | 0b35c560621d5c2f5575d61724864a59a87cdb3c | |
parent | beff5b078ac3ffce1af983bdad53cb0e664439c6 (diff) | |
download | lua-2b4bd21585c15a25fdf7dee6ae7a4fc98916112a.tar.gz lua-2b4bd21585c15a25fdf7dee6ae7a4fc98916112a.tar.bz2 lua-2b4bd21585c15a25fdf7dee6ae7a4fc98916112a.zip |
'tonumber': base must be a number
-rw-r--r-- | lbaselib.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lbaselib.c,v 1.277 2013/05/16 18:35:57 roberto Exp roberto $ | 2 | ** $Id: lbaselib.c,v 1.278 2013/07/05 14:35:49 roberto Exp roberto $ |
3 | ** Basic library | 3 | ** Basic library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -87,7 +87,7 @@ static int luaB_tonumber (lua_State *L) { | |||
87 | size_t l; | 87 | size_t l; |
88 | const char *s; | 88 | const char *s; |
89 | lua_Integer n; | 89 | lua_Integer n; |
90 | int base = lua_tointeger(L, 2); | 90 | int base = luaL_checkint(L, 2); |
91 | luaL_checktype(L, 1, LUA_TSTRING); /* before 'luaL_checklstring'! */ | 91 | luaL_checktype(L, 1, LUA_TSTRING); /* before 'luaL_checklstring'! */ |
92 | s = luaL_checklstring(L, 1, &l); | 92 | s = luaL_checklstring(L, 1, &l); |
93 | luaL_argcheck(L, 2 <= base && base <= 36, 2, "base out of range"); | 93 | luaL_argcheck(L, 2 <= base && base <= 36, 2, "base out of range"); |