Module:CheckUser requests at UTRS

This is an old revision of this page, as edited by HouseBlaster (talk | contribs) at 02:45, 6 February 2025 (oops). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local p = {}

function p.main()
    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 occurrence of 'CHECKUSER'
        local nextMatchRange = string.find(UTRS, 'CHECKUSER', currentStartIndex, true)

        if not nextMatchRange then
            -- no more occurrences found, return the count
            return tostring(numberEncountered)
        else
            -- found a match, so increment the counter and update the current start index
            numberEncountered = numberEncountered + 1
            currentStartIndex = nextMatchRange + 1 -- move past the current match
        end
    end
end

return p