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

This commit is contained in:
Roberto Ierusalimschy
2016-04-11 16:18:40 -03:00
parent c258870c59
commit 82a8e06524

View File

@@ -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 ** Basic library
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@@ -102,8 +102,8 @@ static int luaB_tonumber (lua_State *L) {
static int luaB_error (lua_State *L) { static int luaB_error (lua_State *L) {
int level = (int)luaL_optinteger(L, 2, 1); int level = (int)luaL_optinteger(L, 2, 1);
lua_settop(L, 1); lua_settop(L, 1);
if (lua_isstring(L, 1) && level > 0) { /* add extra information? */ if (lua_type(L, 1) == LUA_TSTRING && level > 0) {
luaL_where(L, level); luaL_where(L, level); /* add extra information */
lua_pushvalue(L, 1); lua_pushvalue(L, 1);
lua_concat(L, 2); lua_concat(L, 2);
} }
@@ -251,9 +251,8 @@ static int ipairsaux (lua_State *L) {
/* /*
** This function will use either 'ipairsaux' or 'ipairsaux_raw' to ** 'ipairs' function. Returns 'ipairsaux', given "table", 0.
** traverse a table, depending on whether the table has metamethods ** (The given "table" may not be a table.)
** that can affect the traversal.
*/ */
static int luaB_ipairs (lua_State *L) { static int luaB_ipairs (lua_State *L) {
#if defined(LUA_COMPAT_IPAIRS) #if defined(LUA_COMPAT_IPAIRS)