aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2012-05-19 15:35:49 +0100
committerMatthew Wild <mwild1@gmail.com>2012-05-19 15:35:49 +0100
commitd964388983926f656fa60b228961aea7c980dcd2 (patch)
tree4bc84196541b5a147a873047b1c631af57f4c2fa
parente4fe19362f79e40fbfd2b436e3e0851c6b13a991 (diff)
downloadprosody-d964388983926f656fa60b228961aea7c980dcd2.tar.gz
prosody-d964388983926f656fa60b228961aea7c980dcd2.zip
util.multitable: No longer use table.remove to drop elements from the stack, when key is nil immediately (on empty tables) the previous stack entry's key gets removed instead
-rw-r--r--util/multitable.lua5
1 files changed, 2 insertions, 3 deletions
diff --git a/util/multitable.lua b/util/multitable.lua
index 388f60f3..299eecb1 100644
--- a/util/multitable.lua
+++ b/util/multitable.lua
@@ -7,7 +7,7 @@
--
local select = select;
-local t_insert, t_remove = table.insert, table.remove;
+local t_insert = table.insert;
local unpack, pairs, next, type = unpack, pairs, next, type;
module "multitable"
@@ -135,8 +135,7 @@ function iter(self, ...)
local depth = #stack;
local key = next(stack[depth], keys[depth]);
if key == nil then -- Go up the stack
- t_remove(stack);
- t_remove(keys);
+ stack[depth], keys[depth] = nil, nil;
if depth > 1 then
return it(self);
end