Module:Othergroups: Difference between revisions
Jump to navigation
Jump to search
use data page + normalize underscores |
m 1 revision imported: some changes are needed ; like removing link to UTRS |
||
(No difference)
|
Latest revision as of 18:24, 12 December 2024
Documentation for this module may be created at Module:Othergroups/doc
local getArgs = require('Module:Arguments').getArgs
local inArray = require('Module:TableTools').inArray
local cfg = require('Module:Othergroups/config')
local data = require('Module:Othergroups/data')
local p = {}
function p.main(frame)
local args = getArgs(frame)
return p._main(args)
end
function p._main(args)
local user = args[1]
local exclude = args[2] or ''
assert(user, "no user")
userGroups = data[user:gsub('_', ' ')]
if userGroups == nil then
return ''
end
ret = ''
for k,v in ipairs(cfg.groups) do
if v ~= exclude and inArray(userGroups, v) then
if #ret > 0 then
ret = ret .. ', '
end
ret = ret .. cfg.pages[v]
end
end
return ret
end
return p