Ver código fonte

details ('error' does not coerce numbers to strings + comments)

Roberto Ierusalimschy 9 anos atrás
pai
commit
82a8e06524
1 arquivos alterados com 5 adições e 6 exclusões
  1. 5 6
      lbaselib.c

+ 5 - 6
lbaselib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lbaselib.c,v 1.311 2015/06/26 19:25:45 roberto Exp roberto $
+** $Id: lbaselib.c,v 1.312 2015/10/29 15:21:04 roberto Exp roberto $
 ** Basic library
 ** See Copyright Notice in lua.h
 */
@@ -102,8 +102,8 @@ static int luaB_tonumber (lua_State *L) {
 static int luaB_error (lua_State *L) {
   int level = (int)luaL_optinteger(L, 2, 1);
   lua_settop(L, 1);
-  if (lua_isstring(L, 1) && level > 0) {  /* add extra information? */
-    luaL_where(L, level);
+  if (lua_type(L, 1) == LUA_TSTRING && level > 0) {
+    luaL_where(L, level);   /* add extra information */
     lua_pushvalue(L, 1);
     lua_concat(L, 2);
   }
@@ -251,9 +251,8 @@ static int ipairsaux (lua_State *L) {
 
 
 /*
-** This function will use either 'ipairsaux' or 'ipairsaux_raw' to
-** traverse a table, depending on whether the table has metamethods
-** that can affect the traversal.
+** 'ipairs' function. Returns 'ipairsaux', given "table", 0.
+** (The given "table" may not be a table.)
 */
 static int luaB_ipairs (lua_State *L) {
 #if defined(LUA_COMPAT_IPAIRS)