Module:Rank

local p = {}

p.Fuzz = function(frame) rank = tonumber(frame.args[1]) or 1 thresholds = frame.args[2] or "10 20 30 40 50 75 100 50" thresh_table = {} last = 1 for token in string.gmatch(thresholds, "[^%s]+") do       token = tonumber(token) or last table.insert(thresh_table, token) last = token end if #thresh_table == 1 then table.insert(thresh_table, last) end if rank <= thresh_table[1] then return rank end idx = 2 while idx < #thresh_table do       if rank <= thresh_table[idx] then return "Top "..thresh_table[idx] end idx = idx + 1 end toprank = math.ceil((rank-thresh_table[#thresh_table-1])/thresh_table[#thresh_table])*thresh_table[#thresh_table]+thresh_table[#thresh_table-1] return "Top "..toprank end

return p