From 80b475353931613e49f4dffac6f2a9b41ef643a8 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy <roberto@inf.puc-rio.br> Date: Wed, 12 Sep 2007 17:53:24 -0300 Subject: better error message for 'concat' --- ltablib.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ltablib.c b/ltablib.c index 28c49f94..f7479545 100644 --- a/ltablib.c +++ b/ltablib.c @@ -1,5 +1,5 @@ /* -** $Id: ltablib.c,v 1.39 2007/06/21 13:48:04 roberto Exp roberto $ +** $Id: ltablib.c,v 1.40 2007/06/21 13:50:53 roberto Exp roberto $ ** Library for Table Manipulation ** See Copyright Notice in lua.h */ @@ -133,7 +133,9 @@ static int tconcat (lua_State *L) { luaL_buffinit(L, &b); for (; i <= last; i++) { lua_rawgeti(L, 1, i); - luaL_argcheck(L, lua_isstring(L, -1), 1, "table contains non-strings"); + if (!lua_isstring(L, -1)) + return luaL_error(L, "invalid value (%s) at index %d in table for " + LUA_QL("concat"), luaL_typename(L, -1), i); luaL_addvalue(&b); if (i != last) luaL_addlstring(&b, sep, lsep); -- cgit v1.2.3-55-g6feb