summaryrefslogtreecommitdiff
path: root/src/ltablib.c
diff options
context:
space:
mode:
authorLua Team <team@lua.org>2010-01-14 12:00:00 +0000
committerrepogen <>2010-01-14 12:00:00 +0000
commitecd48c2901f08a88db32139b97c35c59eba1f19e (patch)
tree526e8dac3e037de0024b37c89fa3150baeea969f /src/ltablib.c
parent22912c77c80f8de8f7accd3319c726f7c5349fd3 (diff)
downloadlua-github-5.2.0-work2.tar.gz
Lua 5.2.0-work25.2.0-work2
Diffstat (limited to 'src/ltablib.c')
-rw-r--r--src/ltablib.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/ltablib.c b/src/ltablib.c
index b2360807..6ad6b8e0 100644
--- a/src/ltablib.c
+++ b/src/ltablib.c
@@ -1,5 +1,5 @@
/*
-** $Id: ltablib.c,v 1.53 2009/12/28 16:30:31 roberto Exp $
+** $Id: ltablib.c,v 1.54 2010/01/13 19:59:10 roberto Exp $
** Library for Table Manipulation
** See Copyright Notice in lua.h
*/
@@ -178,6 +178,8 @@ static int pack (lua_State *L) {
for (; top >= 1; top--) /* assign elements */
lua_rawseti(L, LUA_ENVIRONINDEX, top);
lua_pushvalue(L, LUA_ENVIRONINDEX); /* return new table */
+ /* remove new table from environment to allow its later collection */
+ lua_copy(L, LUA_REGISTRYINDEX, LUA_ENVIRONINDEX);
return 1;
}