From d964388983926f656fa60b228961aea7c980dcd2 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Sat, 19 May 2012 15:35:49 +0100 Subject: 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 --- util/multitable.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'util') 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 -- cgit v1.2.3