aboutsummaryrefslogtreecommitdiff
path: root/ltablib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2010-01-13 17:59:10 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2010-01-13 17:59:10 -0200
commit193ce46970dda16e129ebb28cae085ecf469d702 (patch)
tree7766a34273f886ac879152db503f604495882068 /ltablib.c
parentb678f246a48933723271c4d304eec759a2691e47 (diff)
downloadlua-193ce46970dda16e129ebb28cae085ecf469d702.tar.gz
lua-193ce46970dda16e129ebb28cae085ecf469d702.tar.bz2
lua-193ce46970dda16e129ebb28cae085ecf469d702.zip
table.pack was locking last result, avoiding its collection
Diffstat (limited to 'ltablib.c')
-rw-r--r--ltablib.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ltablib.c b/ltablib.c
index a288633a..e2da6081 100644
--- a/ltablib.c
+++ b/ltablib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltablib.c,v 1.52 2009/12/18 16:53:12 roberto Exp roberto $ 2** $Id: ltablib.c,v 1.53 2009/12/28 16:30:31 roberto Exp roberto $
3** Library for Table Manipulation 3** Library for Table Manipulation
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -178,6 +178,8 @@ static int pack (lua_State *L) {
178 for (; top >= 1; top--) /* assign elements */ 178 for (; top >= 1; top--) /* assign elements */
179 lua_rawseti(L, LUA_ENVIRONINDEX, top); 179 lua_rawseti(L, LUA_ENVIRONINDEX, top);
180 lua_pushvalue(L, LUA_ENVIRONINDEX); /* return new table */ 180 lua_pushvalue(L, LUA_ENVIRONINDEX); /* return new table */
181 /* remove new table from environment to allow its later collection */
182 lua_copy(L, LUA_REGISTRYINDEX, LUA_ENVIRONINDEX);
181 return 1; 183 return 1;
182} 184}
183 185