summaryrefslogtreecommitdiff
path: root/catalogue.lua
diff options
context:
space:
mode:
Diffstat (limited to 'catalogue.lua')
-rw-r--r--catalogue.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/catalogue.lua b/catalogue.lua
index 425dc17..7bd8eb0 100644
--- a/catalogue.lua
+++ b/catalogue.lua
@@ -70,6 +70,19 @@ function mt:add(entry)
return entry
end
+function mt:prune_children(entry, is_child)
+ for _, v in ipairs(entry.children) do
+ self.data[v.id] = nil
+ if v.children then
+ self:prune_children(v, true)
+ end
+ end
+
+ if not is_child then
+ entry.children = {}
+ end
+end
+
function mt:path_to_root(entry)
local path = {}