Преглед изворни кода

'tonumber': base must be a number

Roberto Ierusalimschy пре 12 година
родитељ
комит
2b4bd21585
1 измењених фајлова са 2 додато и 2 уклоњено
  1. 2 2
      lbaselib.c

+ 2 - 2
lbaselib.c

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: lbaselib.c,v 1.277 2013/05/16 18:35:57 roberto Exp roberto $
+** $Id: lbaselib.c,v 1.278 2013/07/05 14:35:49 roberto Exp roberto $
 ** Basic library
 ** Basic library
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -87,7 +87,7 @@ static int luaB_tonumber (lua_State *L) {
     size_t l;
     size_t l;
     const char *s;
     const char *s;
     lua_Integer n;
     lua_Integer n;
-    int base = lua_tointeger(L, 2);
+    int base = luaL_checkint(L, 2);
     luaL_checktype(L, 1, LUA_TSTRING);  /* before 'luaL_checklstring'! */
     luaL_checktype(L, 1, LUA_TSTRING);  /* before 'luaL_checklstring'! */
     s = luaL_checklstring(L, 1, &l);
     s = luaL_checklstring(L, 1, &l);
     luaL_argcheck(L, 2 <= base && base <= 36, 2, "base out of range");
     luaL_argcheck(L, 2 <= base && base <= 36, 2, "base out of range");