Skip to content

Commit

Permalink
Add a couple more WML utility functions
Browse files Browse the repository at this point in the history
  • Loading branch information
CelticMinstrel committed Mar 17, 2018
1 parent f83609a commit 21def91
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions data/lua/core.lua
Expand Up @@ -99,6 +99,28 @@ function wml.child_array(cfg, tag)
return result
end

--! Removes the first matching child tag from @a cfg
function wml.remove_child(cfg, tag)
ensure_config(cfg)
for i,v in ipairs(cfg) do
if v[1] == tag then
table.remove(cfg, i)
return
end
end
end

--! Removes all matching child tags from @a cfg
function wml.remove_children(cfg, ...)
for i = #cfg, 1, -1 do
for _,v in ipairs(...) do
if cfg[i] == v then
table.remove(cfg, i)
end
end
end
end

--[========[WML Tag Creation Table]========]

local create_tag_mt = {
Expand Down

0 comments on commit 21def91

Please sign in to comment.