prpw/cmd/field_remove.lua

17 lines
414 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
2024-08-10 01:03:57 +00:00
local fields = env.xmlFindTags(entry,"fields")[1]
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
2024-08-10 00:35:03 +00:00
end
end
end
end
return cmd