lua

A copy of the Lua development repository
Log | Files | Refs | README

commit f79b4568ae2cffc0eed033ff9029f4f637bc28bd
parent fd5165168453349263faa026fa3ff6ce5fad9441
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Mon,  8 Feb 2016 10:54:53 -0200

details (removed silly use of 'luaL_opt' + better error messages
in cases of "table expected")

Diffstat:
Mltablib.c | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ltablib.c b/ltablib.c @@ -1,5 +1,5 @@ /* -** $Id: ltablib.c,v 1.90 2015/11/25 12:48:57 roberto Exp roberto $ +** $Id: ltablib.c,v 1.91 2015/12/14 11:57:38 roberto Exp roberto $ ** Library for Table Manipulation ** See Copyright Notice in lua.h */ @@ -53,7 +53,7 @@ static void checktab (lua_State *L, int arg, int what) { lua_pop(L, n); /* pop metatable and tested metamethods */ } else - luaL_argerror(L, arg, "table expected"); /* force an error */ + luaL_checktype(L, arg, LUA_TTABLE); /* force an error */ } } @@ -172,7 +172,7 @@ static int tconcat (lua_State *L) { size_t lsep; const char *sep = luaL_optlstring(L, 2, "", &lsep); lua_Integer i = luaL_optinteger(L, 3, 1); - last = luaL_opt(L, luaL_checkinteger, 4, last); + last = luaL_optinteger(L, 4, last); luaL_buffinit(L, &b); for (; i < last; i++) { addfield(L, &b, i);