Changeset

555:1c29c0b22022

Merge from waqas
author Matthew Wild <mwild1@gmail.com>
date Fri, 05 Dec 2008 00:25:41 +0000
parents 553:08db6883bbc5 (current diff) 554:9a695724681d (diff)
children 556:624367a765cd
files
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/util/multitable.lua	Fri Dec 05 00:14:25 2008 +0000
+++ b/util/multitable.lua	Fri Dec 05 00:25:41 2008 +0000
@@ -22,6 +22,7 @@
 local select = select;
 local t_insert = table.insert;
 local pairs = pairs;
+local next = next;
 
 module "multitable"
 
@@ -55,10 +56,19 @@
 	end
 	local k = select(n, ...);
 	if k then
-		r(t[k], n+1, _end, ...);
+		v = t[k];
+		if v then
+			r(v, n+1, _end, ...);
+			if not next(v) then
+				t[k] = nil;
+			end
+		end
 	else
 		for _,b in pairs(t) do
 			r(b, n+1, _end, ...);
+			if not next(b) then
+				t[_] = nil;
+			end
 		end
 	end
 end