Commit f55a3a4b authored by Antoine Cellerier's avatar Antoine Cellerier

Add function to add a children map to an xml table. (children_map[tagname] is...

Add function to add a children map to an xml table. (children_map[tagname] is an array of all the child tags with give name)
parent 8a00b3f2
...@@ -93,3 +93,16 @@ end ...@@ -93,3 +93,16 @@ end
function parse_string(str) function parse_string(str)
return parsexml(vlc.memory_stream(str)) return parsexml(vlc.memory_stream(str))
end end
function add_name_maps(tree)
tree.children_map = {}
for _, node in pairs(tree.children) do
if type(node) == "table" then
if not tree.children_map[node.name] then
tree.children_map[node.name] = {}
end
table.insert(tree.children_map[node.name], node)
add_name_maps(node)
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment