prpw/cmd/field_remove.lua

19 lines
453 B
Lua
Raw Normal View History

2024-08-10 00:35:03 +00:00
local function cmd(args)
local entries = env.xmlFindTags(env.db,"entries")[1]
for i,entry in pairs(entries.children) do
if entry.attrs.id == args[2] then
for i,field in pairs(entry.children) do
if field.tag == "field" then
if field.attrs.name == args[3] then
table.remove(entry.children,i)
entry.attrs.date = env.stringDate(os.date("*t",os.time()))
env.changed = true
end
end
end
end
end
end
return cmd