prpw/cmd/field_remove.lua
2024-08-30 16:02:40 +02:00

19 lines
464 B
Lua

local function cmd(args)
local entries = env.xmlFindTags(env.db,"entries")[1]
for i,entry in pairs(entries.children) do
local fields = env.xmlFindTags(entry,"fields")[1]
if entry.attrs.id == args[2] then
for i,v in pairs(fields.children) do
if v.attrs.name == args[3] then
table.remove(fields.children,i)
entry.attrs.date = env.stringDate(os.date("*t",os.time()))
env.changed = true
break
end
end
end
end
end
return cmd