From 82a8e065247f710aea237563815d82aa5f515905 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 11 Apr 2016 16:18:40 -0300 Subject: details ('error' does not coerce numbers to strings + comments) --- lbaselib.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lbaselib.c b/lbaselib.c index 95ea7dd5..d4c8fef2 100644 --- a/lbaselib.c +++ b/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) -- cgit v1.2.3-55-g6feb