Module:Series

local p = {}

-- Returns the index of a given value in a table, if it exists function getPosInTable(tbl, val) for i,v in ipairs(tbl) do		if v == val then return i		end end return nil end

-- Returns a page footer in wikitext with links to the previous and next pages in the series, if they exist function p.main(frame) local args = frame.args

local series_name = args.title local title = mw.title.getCurrentTitle.fullText

local curPos = getPosInTable(args, title) local prev = curPos and args[curPos - 1] local next = curPos and args[curPos + 1]

local html = ""

html = html .. "" html = html .. "" html = html .. "This article is a part of " .. (series_name and "the " .. series_name or "a") .. " series." html = html .. " "	html = html .. "" html = html .. (prev and "< " .. prev .. " | " or "") .. "'''" .. title .. "'''" .. (next and " | " .. next .. " >" or "") html = html .. " "	html = html .. " "

return html end

return p