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
commit62488ffe3b684f64a863d1515188da42b2058a0f (patch)
tree4bc84196541b5a147a873047b1c631af57f4c2fa
parent62317e3d6f1948213df6ca67bb0f28a0e36022fe (diff)
downloadprosody-62488ffe3b684f64a863d1515188da42b2058a0f.tar.gz
prosody-62488ffe3b684f64a863d1515188da42b2058a0f.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