diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2007-09-12 17:53:24 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2007-09-12 17:53:24 -0300 |
| commit | 80b475353931613e49f4dffac6f2a9b41ef643a8 (patch) | |
| tree | 98f044e7227e95f3017a2bde29e21b164c7c323d | |
| parent | fe0838cd1c75e309f9d136d69f9d77e997181d80 (diff) | |
| download | lua-80b475353931613e49f4dffac6f2a9b41ef643a8.tar.gz lua-80b475353931613e49f4dffac6f2a9b41ef643a8.tar.bz2 lua-80b475353931613e49f4dffac6f2a9b41ef643a8.zip | |
better error message for 'concat'
| -rw-r--r-- | ltablib.c | 6 |
1 files changed, 4 insertions, 2 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltablib.c,v 1.39 2007/06/21 13:48:04 roberto Exp roberto $ | 2 | ** $Id: ltablib.c,v 1.40 2007/06/21 13:50:53 roberto Exp roberto $ |
| 3 | ** Library for Table Manipulation | 3 | ** Library for Table Manipulation |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -133,7 +133,9 @@ static int tconcat (lua_State *L) { | |||
| 133 | luaL_buffinit(L, &b); | 133 | luaL_buffinit(L, &b); |
| 134 | for (; i <= last; i++) { | 134 | for (; i <= last; i++) { |
| 135 | lua_rawgeti(L, 1, i); | 135 | lua_rawgeti(L, 1, i); |
| 136 | luaL_argcheck(L, lua_isstring(L, -1), 1, "table contains non-strings"); | 136 | if (!lua_isstring(L, -1)) |
| 137 | return luaL_error(L, "invalid value (%s) at index %d in table for " | ||
| 138 | LUA_QL("concat"), luaL_typename(L, -1), i); | ||
| 137 | luaL_addvalue(&b); | 139 | luaL_addvalue(&b); |
| 138 | if (i != last) | 140 | if (i != last) |
| 139 | luaL_addlstring(&b, sep, lsep); | 141 | luaL_addlstring(&b, sep, lsep); |
