Module:CheckUser requests at UTRS: Difference between revisions

Content deleted Content added
create a draft
 
tostring not needed
 
(3 intermediate revisions by the same user not shown)
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
-- weno didmore notoccurrences find any occurancesfound, so return the current count
return numberEncountered
else
-- we found the nexta match, so increment the numberEncounteredcounter and update the currentStartIndexcurrent start index
numberEncountered = numberEncountered + 1
currentStartIndex = math.max(nextMatchRange) + 1 -- move past the current match
end
end
end
 
return p