Module:GroupInfobox

local roblox_urls = require('RobloxUrls') local links = require('Links')

return { Title = function(field) if field.Id == '' then return error("You must specify the identifier of the group.") elseif tonumber(field.Id) then return error("The group identifier must be a number.") else return links.plain_external_link(roblox_urls.group(field.Id), field.Value) end end; Owner = function(field) if field.Value == '' then return error("You must specify the owner of the group.") else local owner_page = mw.title.makeTitle('Community', field.Value) -- If the group's owner has a page on this wiki, link to it. Otherwise, link to his ROBLOX profile. if owner_page.exists then return links.wikilink(owner_page, field.Value) else return links.external_link(roblox_urls.user_from_username(field.Value), field.Value) end end end; Activity = function(field) local activity_level = field.Value:lower if activity_level == '' then -- The activity level was difficult to determine, or was not specified for another reason. -- Display nothing. return "" elseif activity_level == 'active' then return "Active" elseif activity_level == 'inactive' then return "Inactive" elseif activity_level == 'abandoned' then return "Abandoned" else error("Unrecognized activity status. Try 'active', 'inactive' or 'abandoned'.") end end; Members = function(field) if field.Value == '' then -- The member count has not been specified, so let's show nothing. return "" else local language = mw.language.getContentLanguage -- This will work even if the number given is already formatted. local members = language:parseFormattedNumber(field.Value) if members then -- Round the number of members and return it formatted. local power = 10^(#tostring(members) - 1) power = power > 1000 and 1000 or power return "Around" .. language:formatNum(math.ceil(members / power) * power) else error("Invalid number of members in the group.") end end end }