Module:Protection banner: Difference between revisions
fix category name function comments
(make the category attempt order more configurable) |
(fix category name function comments) |
||
Line 195: | Line 195: | ||
--[[ | --[[ | ||
-- Define the | -- Define the properties table. Each property is a table containing the | ||
-- | -- canonical order that the property is tested in, the position the | ||
-- | -- property has in the category key strings, and the property value itself. | ||
--]] | --]] | ||
local properties = { | local properties = { | ||
Line 208: | Line 208: | ||
--[[ | --[[ | ||
-- | -- Load the category order configuration for the reason specified. | ||
-- | -- The configuration is stored in the categoryOrder field of each reason | ||
-- | -- subtable of cfg.reasons. If the value is a table, then the order is the | ||
-- | -- values specified in the table. If the value is a string, then the | ||
-- | -- property corresponding to that string is tested last (i.e. it is the most | ||
-- important, because it keeps its specified value the longest) and the | |||
-- other properties are tested in the canonical order. If the value is of | |||
-- any other type then the canonical order is used. | |||
--]] | --]] | ||
local reasonTable = cfg.reasons[reason] | local reasonTable = reason and cfg.reasons[reason] | ||
local categoryOrder = reasonTable and reasonTable.categoryOrder | local categoryOrder = reasonTable and reasonTable.categoryOrder | ||
local categoryOrderType = type(categoryOrder) | local categoryOrderType = type(categoryOrder) |