Add programatic returns to commands

This commit is contained in:
Fierelier 2024-08-12 02:40:40 +02:00
parent d83d268e80
commit 299309735a
5 changed files with 9 additions and 0 deletions

View File

@ -36,6 +36,7 @@ local function cmd(args)
table.insert(entries.children,entry)
env.changed = true
print(entry.attrs.id)
return entry
end
return cmd

View File

@ -1,11 +1,14 @@
local function cmd(args)
local rtn = {}
local entries = env.xmlFindTags(env.db,"entries")[1]
entries = env.xmlFindTags(entries,"entry")
for i,entry in pairs(entries) do
if (entry.attrs.removed ~= "true") then
print(entry.attrs.id .. " " ..entry.attrs.date.. " " ..entry.attrs.name)
table.insert(rtn,entry)
end
end
return rtn
end
return cmd

View File

@ -5,6 +5,7 @@ local function cmd(args)
for i,v in pairs(env.xmlFindTags(v,"fields")[1].children) do
if v.attrs.name == args[3] then
print(v.children[1].text)
return v.children[1].text
end
end
end

View File

@ -5,6 +5,7 @@ local function cmd(args)
for i,v in pairs(env.xmlFindTags(v,"fields")[1].children) do
if v.attrs.name == args[3] then
print(v.attrs.type)
return v.attrs.type
end
end
end

View File

@ -1,12 +1,15 @@
local function cmd(args)
local entries = env.xmlFindTags(env.db,"entries")[1]
local rtn = {}
for i,v in pairs(entries.children) do
if v.attrs.id == args[2] and not v.attrs.deleted then
for i,v in pairs(env.xmlFindTags(v,"fields")[1].children) do
print(v.attrs.name)
table.insert(rtn,v)
end
end
end
return rtn
end
return cmd