Module:Protection banner: Difference between revisions
see if this is possible with just two options
(logic fix) |
(see if this is possible with just two options) |
||
Line 139: | Line 139: | ||
-- rule for every idiosyncracy that was in the old template system. | -- rule for every idiosyncracy that was in the old template system. | ||
local keyTable = {protType, protLevel, namespace, reason, expiry} | local keyTable = {protType, protLevel, namespace, reason, expiry} | ||
local reasonBehaviors = { | local reasonBehaviors = { | ||
Line 164: | Line 145: | ||
blp = 'reasonFirst', | blp = 'reasonFirst', | ||
sock = 'reasonFirst', | sock = 'reasonFirst', | ||
office = ' | office = 'reasonFirst', | ||
} | } | ||
local reasonBehavior = reasonBehaviors[reason] | local reasonBehavior = reasonBehaviors[reason] | ||
if reasonBehavior == ' | local attemptOrder | ||
if reasonBehavior == 'reasonFirst' then | |||
attemptOrder = { | |||
-- type, level, ns, reason, expiry | |||
{true, true, true, true, true}, -- 1 | |||
{true, true, true, true, false}, -- 2 | |||
{true, true, false, true, true}, -- 3 | |||
{true, true, false, true, false}, -- 4 | |||
{true, false, true, true, true}, -- 5 | |||
{true, false, true, true, false}, -- 6 | |||
{true, false, false, true, true}, -- 7 | |||
{true, false, false, true, false}, -- 8 | |||
{false, false, false, true, false}, -- 9 | |||
{true, true, true, false, true}, -- 10 | |||
{true, true, true, false, false}, -- 11 | |||
{true, true, false, false, true}, -- 12 | |||
{true, false, true, false, true}, -- 13 | |||
{true, false, true, false, false}, -- 14 | |||
{true, false, false, false, true}, -- 15 | |||
{true, false, false, false, false}, -- 16 | |||
{false, false, false, false, false} -- 17 | |||
} | |||
elseif reasonBehavior == 'namespaceFirst' then | elseif reasonBehavior == 'namespaceFirst' then | ||
-- | attemptOrder = { | ||
-- type, level, ns, reason, expiry | |||
{true, true, true, true, true}, -- 1 | |||
elseif | {true, true, true, true, false}, -- 2 | ||
{true, true, true, false, true}, -- 3 | |||
{true, true, true, false, false}, -- 4 | |||
{true, false, true, true, true}, -- 5 | |||
{true, false, true, true, false}, -- 6 | |||
{true, false, true, false, true}, -- 7 | |||
{true, false, true, false, false}, -- 8 | |||
{false, false, true, false, false}, -- 9 | |||
{true, true, false, true, true}, -- 10 | |||
{true, true, false, true, false}, -- 11 | |||
{true, true, false, false, true}, -- 12 | |||
{true, false, false, true, true}, -- 13 | |||
{true, false, false, true, false}, -- 14 | |||
{true, false, false, false, true}, -- 15 | |||
{true, false, false, false, false}, -- 16 | |||
{false, false, false, false, false} -- 17 | |||
} | |||
elseif reason ~= 'all' then | |||
error(reason .. ' is not a valid reason') | error(reason .. ' is not a valid reason') | ||
end | end |