prpw/cmd/field_remove.lua

17 lines
414 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]
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
return cmd