'table.pack' does not return 'n' (may be confusing when
using table.pack as last argument in a call)
This commit is contained in:
@@ -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 */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user