'table.pack' does not return 'n' (may be confusing when

using table.pack as last argument in a call)
This commit is contained in:
Roberto Ierusalimschy 2011-11-28 15:26:30 -02:00
parent 217b65e6d9
commit ece042fef0
1 changed files with 2 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/* /*
** $Id: ltablib.c,v 1.61 2011/07/05 12:49:35 roberto Exp roberto $ ** $Id: ltablib.c,v 1.62 2011/09/30 12:45:45 roberto Exp roberto $
** Library for Table Manipulation ** Library for Table Manipulation
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -129,8 +129,7 @@ static int pack (lua_State *L) {
for (i = n; i >= 2; i--) /* assign other elements */ for (i = n; i >= 2; i--) /* assign other elements */
lua_rawseti(L, 1, i); lua_rawseti(L, 1, i);
} }
lua_pushinteger(L, n); return 1; /* return table */
return 2; /* return table and number of elements */
} }