Fandom

Parks and Recreation Wiki

Module:Episode

578pages on
this wiki
Add New Page
Talk0

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

local p = {}
local data = mw.loadData('Module:Episode/data')
 
function p.link(frame)
    local args = frame.args
    local episode = mw.title.getCurrentTitle().text
    if args[2] ~= nil and args[2] ~= "" then
        episode = args[2]
    end
    local dir = tonumber(args[1])
    local function ret(current)
        if current ~= nul then
            if mw.ustring.find(current, "(", 0, true) then
                return "\"[[" .. current .. "|" .. mw.ustring.sub(current, 0, mw.ustring.find(current, "(", 0, true) - 2) .. "]]\""
            else
                return "\"[[" .. current .. "]]\""
            end
        else
            return "—"
        end
    end
    for i, v in ipairs(data) do
        if v == episode then
            return ret(data[i + dir])
        end
    end
end
 
function p.overall()
    local episode = mw.title.getCurrentTitle().text
    for i, v in ipairs(data) do
        if v == episode then
            if i == 91 then
                return i .. "/" .. i + 1
            end
            if 91 < i then
                i = i + 1
            end
            if i == 111 then
                return i .. "/" .. i + 1
            end
            if 111 < i then
                i = i + 1
            end
            if i == 124 then
                return i .. "/" .. i + 1
            end
            return i
        end
    end
end
 
return p

Also on Fandom

Random Wiki