Документацію для цього модуля можна створити у Модуль:Players/документація
local p = {}
function p.fetchRandomMembers(frame)
local categoryName = 'Учасники_спільноти_MCC' -- The category from which to fetch members
local category = mw.title.makeTitle(14, categoryName) -- Namespace 14 is for categories
local members = category:getCategoryMembers()
local count = 4 -- Number of random members to fetch
local output = '<ul>\n'
-- Shuffle the array of members randomly and select the top few
local shuffled = {}
for index, value in ipairs(members) do
local pos = math.random(1, #shuffled+1)
table.insert(shuffled, pos, value)
end
for i = 1, math.min(count, #shuffled) do
local title = shuffled[i].fullText
output = output .. '<li><a href="/wiki/' .. mw.text.encode(title) .. '">' .. mw.text.decode(title) .. '</a></li>\n'
end
output = output .. '</ul>\n'
return output
end
return p