lua

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

commit fe0d54d37edd3d28d42a01db013e04cc12e97f2f
parent c9af0768fc009bac1c2eb929a81e39b74f8956a5
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Fri, 17 Dec 2010 10:15:10 -0200

table library respects '#' metamethods

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

diff --git a/ltablib.c b/ltablib.c @@ -1,5 +1,5 @@ /* -** $Id: ltablib.c,v 1.57 2010/10/25 19:01:37 roberto Exp roberto $ +** $Id: ltablib.c,v 1.58 2010/11/23 17:21:14 roberto Exp roberto $ ** Library for Table Manipulation ** See Copyright Notice in lua.h */ @@ -17,7 +17,7 @@ #define aux_getn(L,n) \ - (luaL_checktype(L, n, LUA_TTABLE), (int)lua_rawlen(L, n)) + (luaL_checktype(L, n, LUA_TTABLE), luaL_len(L, n)) static int deprecatedfunc (lua_State *L) { @@ -104,7 +104,7 @@ static int tconcat (lua_State *L) { const char *sep = luaL_optlstring(L, 2, "", &lsep); luaL_checktype(L, 1, LUA_TTABLE); i = luaL_optint(L, 3, 1); - last = luaL_opt(L, luaL_checkint, 4, (int)lua_rawlen(L, 1)); + last = luaL_opt(L, luaL_checkint, 4, luaL_len(L, 1)); luaL_buffinit(L, &b); for (; i < last; i++) { addfield(L, &b, i); @@ -143,7 +143,7 @@ static int unpack (lua_State *L) { int i, e, n; luaL_checktype(L, 1, LUA_TTABLE); i = luaL_optint(L, 2, 1); - e = luaL_opt(L, luaL_checkint, 3, (int)lua_rawlen(L, 1)); + e = luaL_opt(L, luaL_checkint, 3, luaL_len(L, 1)); if (i > e) return 0; /* empty range */ n = e - i + 1; /* number of elements */ if (n <= 0 || !lua_checkstack(L, n)) /* n <= 0 means arith. overflow */