Module:ListMembersBySecurity

local p = {}

--% This function gets members by their security. --% Properties have separate read and write security, so they can have two different securities. In that case, they are present in both tables. --: (table) the members by security: keys are the security, values are the array of members with that security local function get_members_by_security local members_by_security = {} for _, class in ipairs(mw.loadData("Module:APIDump").data.Classes) do       for _, member in ipairs(class.Members) do            if member.Security then if type(member.Security) == "string" then if member.Security ~= "None" then if not members_by_security[member.Security] then members_by_security[member.Security] = {} end table.insert(members_by_security[member.Security], member) end elseif type(member.Security) == "table" then local read_security = member.Security.Read local write_security = member.Security.Write if read_security ~= "None" or write_security ~= "None" then if read_security == write_security then if not members_by_security[read_security] then members_by_security[read_security] = {} end table.insert(members_by_security[read_security], member) else if read_security ~= "None" then if not members_by_security[read_security] then members_by_security[read_security] = {} end table.insert(members_by_security[read_security], member) end if write_security ~= "None" then if not members_by_security[write_security] then members_by_security[write_security] = {} end table.insert(members_by_security[write_security], member) end end end else return error("Unexpected member security type: " .. type(member.Security)) end end end end return members_by_security end

return p