Changed modpol.orgs.list_all to return table not string
This commit is contained in:
parent
a6cd6ebcfe
commit
9f65e2bdd3
@ -12,7 +12,8 @@
|
|||||||
modpol.dashboard = function(user)
|
modpol.dashboard = function(user)
|
||||||
local output = ""
|
local output = ""
|
||||||
-- Org status
|
-- Org status
|
||||||
output = output .. "Orgs:\n" .. modpol.orgs.list_all()
|
output = output .. "Orgs:\n" ..
|
||||||
|
table.concat(modpol.orgs.list_all(),"\n")
|
||||||
-- Process status (ongoing processes)
|
-- Process status (ongoing processes)
|
||||||
output = output .. "\nProcesses:\n" .. table.concat(modpol.processes)
|
output = output .. "\nProcesses:\n" .. table.concat(modpol.processes)
|
||||||
-- Command list (should be redone to be org-specific)
|
-- Command list (should be redone to be org-specific)
|
||||||
|
@ -23,19 +23,19 @@ function modpol.orgs.get_org(arg)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- ===============================================
|
-- ===============================================
|
||||||
-- returns a string list of all orgs
|
-- returns a table list of all org names
|
||||||
function modpol.orgs.list_all()
|
function modpol.orgs.list_all()
|
||||||
local str
|
local org_table
|
||||||
for k, v in ipairs(modpol.orgs.array) do
|
for k, v in ipairs(modpol.orgs.array) do
|
||||||
if type(v) == 'table' then
|
if type(v) == 'table' then
|
||||||
if str then
|
if org_table then
|
||||||
str = str .. '\n' .. v.name
|
table.insert(org_table, v.name)
|
||||||
else
|
else
|
||||||
str = v.name
|
org_table = {v.name}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return str
|
return org_table
|
||||||
end
|
end
|
||||||
|
|
||||||
-- ===========================================
|
-- ===========================================
|
||||||
|
@ -56,17 +56,18 @@ regchat(
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- ===================================================================
|
-- ===================================================================
|
||||||
-- /listorg
|
-- /listorgs
|
||||||
-- In Minetest mode, this code defines a chat command which lists the
|
-- In Minetest mode, this code defines a chat command which lists
|
||||||
-- existing "orgs".
|
-- existing "orgs".
|
||||||
-- The list shows one "org" per line in the following format:
|
-- The list shows one "org" per line in the following format:
|
||||||
-- org_name (member, member, ...)
|
-- org_name (member, member, ...)
|
||||||
|
|
||||||
regchat(
|
regchat(
|
||||||
"listorg", {
|
"listorgs", {
|
||||||
privs = {} ,
|
privs = {} ,
|
||||||
func = function (user, param)
|
func = function (user, param)
|
||||||
return true, "Orgs:\n" .. modpol.orgs.list_all()
|
return true, "Orgs: " ..
|
||||||
|
table.concat(modpol.orgs.list_all(), ", ")
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -12,7 +12,8 @@ modpol.dashboard = function(user)
|
|||||||
for key,value in pairs(command_list) do
|
for key,value in pairs(command_list) do
|
||||||
commands = commands .. "/" .. value .. " "
|
commands = commands .. "/" .. value .. " "
|
||||||
end
|
end
|
||||||
local orgs = "Orgs: " .. modpol.orgs.list_all()
|
local orgs = "Orgs: " ..
|
||||||
|
table.concat(modpol.orgs.list_all(), ", ")
|
||||||
local users = "Players: "
|
local users = "Players: "
|
||||||
.. table.concat(modpol.list_users(), ", ")
|
.. table.concat(modpol.list_users(), ", ")
|
||||||
-- set up formspec
|
-- set up formspec
|
||||||
|
Loading…
x
Reference in New Issue
Block a user