From 193ce46970dda16e129ebb28cae085ecf469d702 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 13 Jan 2010 17:59:10 -0200 Subject: table.pack was locking last result, avoiding its collection --- ltablib.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ltablib.c b/ltablib.c index a288633a..e2da6081 100644 --- a/ltablib.c +++ b/ltablib.c @@ -1,5 +1,5 @@ /* -** $Id: ltablib.c,v 1.52 2009/12/18 16:53:12 roberto Exp roberto $ +** $Id: ltablib.c,v 1.53 2009/12/28 16:30:31 roberto Exp roberto $ ** 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; } -- cgit v1.2.3-55-g6feb