Module:MemberIcon

local p = {}

local function is_protected(member) if member.MemberType == "Property" then return member.Security and (           member.Security.Read and member.Security.Read ~= "" and member.Security.Read ~= "None"            or            member.Security.Write and member.Security.Write ~= "" and member.Security.Write ~= "None"        ) elseif member.MemberType == "Function" or member.MemberType == "Event" or member.MemberType == "Callback" then return member.Security and member.Security ~= "" and member.Security ~= "None" else return error("Unknown member type: " .. member.MemberType) end end

function p.make_member_icon(member) local icon_file_name = "" local link = "" if member.MemberType == "Property" then -- Currently, Privfield.gif is not used. link = "Property" if is_protected(member) then icon_file_name = "Protfield.gif" else icon_file_name = "Pubfield.gif" end elseif member.MemberType == "Function" then -- Currently, Privmethod.gif is not used. link = "Method" if is_protected(member) then icon_file_name = "Protmethod.gif" else icon_file_name = "Pubmethod.gif" end elseif member.MemberType == "Event" then -- Currently, Privevent.gif is not used. link = "Event (Lua)" if is_protected(member) then icon_file_name = "Protevent.gif" else icon_file_name = "Pubevent.gif" end elseif member.MemberType == "Callback" then -- We do not have an icon for protected callbacks. link = "Callback" icon_file_name = "Callback icon.png" else return error("Unknown member type: " .. member.MemberType) end return "" end

return p