FANDOM


--<nowiki>
local p = {}
 
function p.listing( frame )
    local page = mw.allToString( mw.title.getCurrentTitle() ).."/Archive "
    local out = {}
    for i = 10, 100, 10 do
        if mw.title.new( page..i ).exists then
            for j = i - 9, i do
                table.insert( out, "[["..page..j.."|#"..j.."]]" )
            end
        else
            if mw.title.new( page..(i - 5) ).exists then
                for j = i - 9, i - 5 do
                    table.insert( out, "[["..page..j.."|#"..j.."]]" )
                end
                for j = i - 4, i do
                    if mw.title.new( page..j ).exists then
                        table.insert( out, "[["..page..j.."|#"..j.."]]" )
                    else
                        break
                    end
                end
            else
                for j = i - 9, i do
                    if mw.title.new( page..j ).exists then
                        table.insert( out, "[["..page..j.."|#"..j.."]]" )
                    else
                        break
                    end
                end
            end
            break
        end
    end
    return table.concat( out, ", " )
end
 
return p
--</nowiki>