Anonymous user
Module:Protection banner: Difference between revisions
change this to something that should work if I can get the order figured out
Enwikipedia>Mr. Stradivarius (save progress in simplifying the attempt order algorithm) |
Enwikipedia>Mr. Stradivarius (change this to something that should work if I can get the order figured out) |
||
Line 83:
-- Define often-used functions as local variables.
local tconcat = table.concat
local tinsert = table.insert
local floor = math.floor
Line 111 ⟶ 112:
-- Preprocess parameters
cats = cats or categories
local properties = {}
properties.protLevel = protLevel or 'all'
properties.namespace = p.matchNamespace(namespace)
properties.reason = reason or 'all'
if not expiry then
properties.expiry = 'all'
elseif expiry ~= 'indef' then
properties.expiry = 'temp'
end
local
local behavior = behaviors[reason]
if behavior == 'namespaceFirst' then
tinsert(
elseif behavior ~= 'reasonFirst' and reason ~= 'all' then
error(reason .. ' is not a valid reason')
end
local
for i,
if
end
end
local noActiveProperties = #
-- Try successively generic matches until we run out of key combinations
for i = 1, 2^noActiveProperties do
local
for pos = 1, 5 do
if pos > noActiveProperties then
else
local quotient = i / 2 ^ (pos - 1)
quotient = floor(quotient)
if quotient % 2 == 1 then
else -- quotient % 2 == 0
end
end
end
mw.log(
local attempt = cats[
if attempt then
return attempt
|