Module:CheckUser requests at UTRS: Difference between revisions

Content deleted Content added
test
oops
Line 1:
local p = {}
 
function p.main(args)
local UTRS = mw.title.new('User:AmandaNP/UTRS Appeals').content -- get the UTRS table
local numberEncountered = 0 -- initialize the counter
local currentStartIndex = 1 -- initialize the index
 
while true do
-- find the next occuranceoccurrence of 'CHECKUSER'
local nextMatchRange = string.find(UTRS, 'CHECKUSER', currentStartIndex, true)
if not nextMatchRange then
 
-- we did not find any occurances, so return the current count
if not nextMatchRange then
return tostring(numberEncountered)
-- no more occurrences found, return the count
else
return tostring(numberEncountered)
-- we found the next match, so increment the numberEncountered and update the currentStartIndex
else
numberEncountered = numberEncountered + 1
-- we found the nexta match, so increment the numberEncounteredcounter and update the currentStartIndexcurrent start index
currentStartIndex = math.max(nextMatchRange)
numberEncountered = numberEncountered + 1
end
currentStartIndex = nextMatchRange + 1 -- move past the current match
end
end
end
end
 
return p