Module:ClansList

local p = {} clans = mw.loadData("Module:ClansList/Clans") --Generates the individual entry of a table from the data. local generateClanEntry = function(clanData) local wikitext = {} table.insert(wikitext, -       | style="text-align:center;width:120px;border-right:1px solid #4f4f4f;border-bottom:1px solid #4f4f4f" |) table.insert(wikitext, " " .. (clanData.Name or "N/A") .. "\n") table.insert(wikitext, | style="border-bottom:1px solid ) table.insert(wikitext, "Member count: " .. (clanData.MemberCount or "N/A") .. " ") table.insert(wikitext, "Association: " .. (clanData.Association or "N/A") .. " ") table.insert(wikitext, "Requirements: " .. (clanData.Requirements or "N/A") .. " ") table.insert(wikitext, "Recruiter: " .. (clanData.Recruiter or "N/A") .. " ") table.insert(wikitext, "Contact: " .. (clanData.Contact or "N/A") .. " ") table.insert(wikitext, "Discord Link: " .. (clanData.Discord or "N/A") .. " \n") return table.concat(wikitext) end --Function to randomise the order of a table, using Fisher-Yates. Pasted straight from stackoverflow. local function shuffle(t) math.randomseed(os.time) local tbl = {} i = 0 for _, clanData in pairs(clans) do       i = i + 1 tbl[i] = clanData end for i = #tbl, 2, -1 do       local j = math.random(i) tbl[i], tbl[j] = tbl[j], tbl[i] end return tbl end --Generates a full wikitext list of all clans in clanInfo, in a random order. p.GenerateClansList = function(Frame) local wikitext = {} table.insert(wikitext, header) shuffledClans = shuffle(clans) for _, clanData in pairs(shuffledClans) do       if type(clanData) == "table" then table.insert(wikitext, generateClanEntry(clanData)) else --Bad clan data (likely from personal data page), skip it. --Maybe add better handling later. end end table.insert(wikitext, "|}") return table.concat(wikitext) end return p