diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2016-02-08 10:55:19 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2016-02-08 10:55:19 -0200 |
| commit | f79b4568ae2cffc0eed033ff9029f4f637bc28bd (patch) | |
| tree | 275dcbc0a2843cd76ee10630d8e2521d6c19bbef | |
| parent | fd5165168453349263faa026fa3ff6ce5fad9441 (diff) | |
| download | lua-f79b4568ae2cffc0eed033ff9029f4f637bc28bd.tar.gz lua-f79b4568ae2cffc0eed033ff9029f4f637bc28bd.tar.bz2 lua-f79b4568ae2cffc0eed033ff9029f4f637bc28bd.zip | |
details (removed silly use of 'luaL_opt' + better error messages
in cases of "table expected")
| -rw-r--r-- | ltablib.c | 6 |
1 files changed, 3 insertions, 3 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltablib.c,v 1.90 2015/11/25 12:48:57 roberto Exp roberto $ | 2 | ** $Id: ltablib.c,v 1.91 2015/12/14 11:57:38 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 | */ |
| @@ -53,7 +53,7 @@ static void checktab (lua_State *L, int arg, int what) { | |||
| 53 | lua_pop(L, n); /* pop metatable and tested metamethods */ | 53 | lua_pop(L, n); /* pop metatable and tested metamethods */ |
| 54 | } | 54 | } |
| 55 | else | 55 | else |
| 56 | luaL_argerror(L, arg, "table expected"); /* force an error */ | 56 | luaL_checktype(L, arg, LUA_TTABLE); /* force an error */ |
| 57 | } | 57 | } |
| 58 | } | 58 | } |
| 59 | 59 | ||
| @@ -172,7 +172,7 @@ static int tconcat (lua_State *L) { | |||
| 172 | size_t lsep; | 172 | size_t lsep; |
| 173 | const char *sep = luaL_optlstring(L, 2, "", &lsep); | 173 | const char *sep = luaL_optlstring(L, 2, "", &lsep); |
| 174 | lua_Integer i = luaL_optinteger(L, 3, 1); | 174 | lua_Integer i = luaL_optinteger(L, 3, 1); |
| 175 | last = luaL_opt(L, luaL_checkinteger, 4, last); | 175 | last = luaL_optinteger(L, 4, last); |
| 176 | luaL_buffinit(L, &b); | 176 | luaL_buffinit(L, &b); |
| 177 | for (; i < last; i++) { | 177 | for (; i < last; i++) { |
| 178 | addfield(L, &b, i); | 178 | addfield(L, &b, i); |
