Software /
code /
prosody
Changeset
4895:36df30395c44
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
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 19 May 2012 15:35:49 +0100 (2012-05-19) |
parents | 4894:c874dc4ccbd7 |
children | 4896:27cda15104f2 |
files | util/multitable.lua |
diffstat | 1 files changed, 2 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/util/multitable.lua Sat May 19 04:12:41 2012 +0100 +++ b/util/multitable.lua Sat May 19 15:35:49 2012 +0100 @@ -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 @@ 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