diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-01-13 17:59:10 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-01-13 17:59:10 -0200 |
| commit | 193ce46970dda16e129ebb28cae085ecf469d702 (patch) | |
| tree | 7766a34273f886ac879152db503f604495882068 | |
| parent | b678f246a48933723271c4d304eec759a2691e47 (diff) | |
| download | lua-193ce46970dda16e129ebb28cae085ecf469d702.tar.gz lua-193ce46970dda16e129ebb28cae085ecf469d702.tar.bz2 lua-193ce46970dda16e129ebb28cae085ecf469d702.zip | |
table.pack was locking last result, avoiding its collection
| -rw-r--r-- | ltablib.c | 4 |
1 files changed, 3 insertions, 1 deletions
| @@ -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 | ||
