Site News
Warning: This wiki contains spoilers. Read at your own risk!

Social media: If you would like, please join our Discord server, and/or follow us on Twitter (X) or Tumblr!

Module:PageList

From Fire Emblem Wiki, your source on Fire Emblem information. By fans, for fans.
Revision as of 15:54, 7 August 2022 by Thecornerman (talk | contribs)

Creates a list of links to articles. Used in {{Split}} and {{Merge}}.


local p = {}

function p.pagelist(frame)
	local pages = frame:getParent().args
	
    total = 0
    for k,v in pairs(pages) do
        if type(k) == "number" then
            total = total + 1
        end
    end
    
    if total == 1 then
        output = string.format("[[%s]]", pages[1])
    elseif total == 2 then
        output = string.format("[[%s]] and [[%s]]", pages[1], pages[2])
    else
        i = 1
        output = ""
        repeat
            output = string.format("%s[[%s]], ", output, pages[i])
            i = i + 1
        until i == total
        output = string.format("%sand [[%s]]", output, pages[i])
    end
    return output
end

return p