Module:MediumLink

local p = {}

local function getArgs(frame) local args = {} for key, value in pairs(frame:getParent.args) do       args[key] = value end for key, value in pairs(frame.args) do       args[key] = value end return args end

function p.main(frame) local args       = getArgs(frame) local medium     = args.medium or '' local link       = args.link or '' local short      = args.short or '' local shorter    = args.shorter or '' local shortest   = args.shortest or '' local mode1      = args[1] or args.mode1 or '' local mode2      = args[2] or args.mode2 or '' local mode3      = args[3] or args.mode3 or '' local mode4      = args[4] or args.mode4 or '' if medium == "Super Smash Bros. 4" then return p.outputSSB4Link(mode1, mode2, mode3, mode4) else return p.outputMediumLink(medium, link, short, shorter, shortest, mode1, mode2, mode3) end end

function p.outputMediumLink(medium, link, short, shorter, shortest, mode1, mode2, mode3) local function isEmpty(s) return s == nil or s == '' end local print = '' local linkindicator = '' if medium == "Gekijōban Doubutsu no Mori" then linkindicator = "🎬 " end local error = '\'\'\' Invalid parameters detected! Did you entered the wrong parameters or are the parameters needed to generate this link empty? \'\'\''	if not isEmpty(mode1) then if mode1 == "nolink" then if not isEmpty(short) and mode2 == "short" then if mode3 == "sm" then print = " ''" .. short .. "'' "				elseif isEmpty(mode3) then print = "''" .. short .. "''"				else print = error end elseif not isEmpty(shorter) and mode2 == "shorter" then if mode3 == "sm" then print = " " .. shorter .. " "				elseif isEmpty(mode3) then print = shorter else print = error end elseif not isEmpty(shortest) and mode2 == "shortest" then if mode3 == "sm" then print = " " .. shortest .. " "				elseif isEmpty(mode3) then print = shortest else print = error end elseif mode2 == "sm" then if not isEmpty(short) and mode3 == "short" then print = " ''" .. short .. "'' "				elseif not isEmpty(shorter) and mode3 == "shorter" then print = " " .. shorter .. " "				elseif not isEmpty(shortest) and mode3 == "shortest" then print = " " .. shortest .. " "				elseif isEmpty(mode3) then print = " ''" .. medium .. "'' "				else print = error end elseif isEmpty(mode2) then print = "''" .. medium .. "''"			else print = error end elseif not isEmpty(short) and mode1 == "short" then if mode2 == "nolink" then if mode3 == "sm" then print = " ''" .. short .. "'' "				elseif isEmpty(mode3) then print = "''" .. short .. "''"				else print = error end elseif mode2 == "sm" then if mode3 == "nolink" then print = " ''" .. short .. "'' "				elseif isEmpty(mode3) then if not isEmpty(link) then print = " " .. linkindicator .. "" .. short .. " " else print = " " .. linkindicator .. "" .. short .. " " end else print = error end elseif isEmpty(mode2) then if not isEmpty(link) then print = "" .. linkindicator .. "" .. short .. "" else print = "" .. linkindicator .. "" .. short .. "" end else print = error end elseif not isEmpty(shorter) and mode1 == "shorter" then if mode2 == "nolink" then if mode3 == "sm" then print = " " .. shorter .. " "				elseif isEmpty(mode3) then print = shorter else print = error end elseif mode2 == "sm" then if mode3 == "nolink" then print = " " .. shorter .. " "				elseif isEmpty(mode3) then if not isEmpty(link) then print = " " .. linkindicator .. shorter .. " " else print = " " .. linkindicator .. shorter .. " " end else print = error end elseif isEmpty(mode2) then if not isEmpty(link) then print = "" .. linkindicator .. shorter .. "" else print = "" .. linkindicator .. shorter .. "" end else print = error end elseif not isEmpty(shortest) and mode1 == "shortest" then if mode2 == "nolink" then if mode3 == "sm" then print = " " .. shortest .. " "				elseif isEmpty(mode3) then print = shortest else print = error end elseif mode2 == "sm" then if mode3 == "nolink" then print = " " .. shortest .. " "				elseif isEmpty(mode3) then if not isEmpty(link) then print = " " .. linkindicator .. shortest .. " " else print = " " .. linkindicator .. shortest .. " " end else print = error end elseif isEmpty(mode2) then if not isEmpty(link) then print = "" .. linkindicator .. shortest .. "" else print = "" .. linkindicator .. shortest .. "" end else print = error end elseif mode1 == "sm" then if mode2 == "nolink" then if not isEmpty(short) and mode3 == "short" then print = " ''" .. short .. "'' "				elseif not isEmpty(shorter) and mode3 == "shorter" then print = " " .. shorter .. " "				elseif not isEmpty(shortest) and mode3 == "shortest" then print = " " .. shortest .. " "				elseif isEmpty(mode3) then print = " ''" .. medium .. "'' "				else print = error end elseif not isEmpty(short) and mode2 == "short" then if mode3 == "nolink" then print = " ''" .. short .. "'' "				elseif isEmpty(mode3) then if not isEmpty(link) then print = " " .. linkindicator .. "" .. short .. " " else print = " " .. linkindicator .. "" .. short .. " " end else print = error end elseif not isEmpty(shorter) and mode2 == "shorter" then if mode3 == "nolink" then print = " " .. shorter .. " "				elseif isEmpty(mode3) then if not isEmpty(link) then print = " " .. linkindicator .. shorter .. " " else print = " " .. linkindicator .. shorter .. " " end else print = error end elseif not isEmpty(shortest) and mode2 == "shortest" then if mode3 == "nolink" then print = " " .. shortest .. " "				elseif isEmpty(mode3) then if not isEmpty(link) then print = " " .. linkindicator .. shortest .. " " else print = " " .. linkindicator .. shortest .. " " end else print = error end elseif isEmpty(mode2) then if not isEmpty(link) then print = " " .. linkindicator .. "" .. medium .. " " elseif not isEmpty(linkindicator) then print = " " .. linkindicator .. "" .. medium .. " " else print = " " .. medium .. " " end else print = error end else print = error end elseif isEmpty(mode1) then if not isEmpty(link) then print = "" .. linkindicator .. "" .. medium .. "" elseif not isEmpty(linkindicator) then print = "" .. linkindicator .. "" .. medium .. "" else print = "" .. medium .. "" end else print = error end return print end

function p.outputSSB4Link(mode1, mode2, mode3, mode4) local function isEmpty(s) return s == nil or s == '' end local print = '' local error = '\'\'\' Invalid parameters detected! Did you entered the wrong parameters? \'\'\''	if not isEmpty(mode1) then if mode1 == "nolink" then if not mode2 == "short" then if mode3 == "sm" then if mode4 == "3ds" then print = " Smash 3DS " elseif mode4 == "wiiu" then print = " Smash Wii U " elseif mode4 == "3dswiiu" or mode4 == "wiiu3ds" then print = " Smash 3DS / Wii U " elseif isEmpty(mode4) then print = " Smash 4 " else print = error end elseif mode3 == "3ds" then if mode4 == "sm" then print = " Smash 3DS " elseif isEmpty(mode4) then print = "Smash 3DS" else print = error end elseif mode3 == "wiiu" then if mode4 == "sm" then print = " Smash Wii U " elseif isEmpty(mode4) then print = "Smash Wii U" else print = error end elseif mode3 == "3dswiiu" or mode4 == "wiiu3ds" then if mode4 == "sm" then print = " Smash 3DS / Wii U " elseif isEmpty(mode4) then print = "Smash 3DS / Wii U" else print = error end elseif isEmpty(mode3) then print = "Smash 4" else print = error end elseif mode2 == "shorter" then if mode3 == "sm" then if mode4 == "3ds" then print = " SSB:3DS " elseif mode4 == "wiiu" then print = " SSB:Wii U " elseif mode4 == "3dswiiu" or mode4 == "wiiu3ds" then print = " SSB:3DS/Wii U " elseif isEmpty(mode4) then print = " SSB4 " else print = error end elseif mode3 == "3ds" then if mode4 == "sm" then print = " SSB:3DS " elseif isEmpty(mode4) then print = "SSB:3DS" else print = error end elseif mode3 == "wiiu" then if mode4 == "sm" then print = " SSB:Wii U " elseif isEmpty(mode4) then print = "SSB:Wii U"					else print = error end elseif mode3 == "3dswiiu" or mode4 == "wiiu3ds" then if mode4 == "sm" then print = " SSB:3DS/Wii U " elseif isEmpty(mode4) then print = "SSB:3DS/Wii U"					else print = error end elseif isEmpty(mode3) then print = "SSB4" else print = error end elseif mode2 == "shortest" then if mode3 == "sm" then if mode4 == "3ds" then print = " SSB:3DS " elseif mode4 == "wiiu" then print = " SSB:Wii U " elseif mode4 == "3dswiiu" or mode4 == "wiiu3ds" then print = " SSB:3DS/Wii U " elseif isEmpty(mode4) then print = " SSB4 " else print = error end elseif mode3 == "3ds" then if mode4 == "sm" then print = " SSB:3DS " elseif isEmpty(mode4) then print = "SSB:3DS" else print = error end elseif mode3 == "wiiu" then if mode4 == "sm" then print = " SSB:Wii U " elseif isEmpty(mode4) then print = "SSB:Wii U"					else print = error end elseif mode3 == "3dswiiu" or mode4 == "wiiu3ds" then if mode4 == "sm" then print = " SSB:3DS/Wii U " elseif isEmpty(mode4) then print = "SSB:3DS/Wii U"					else print = error end elseif isEmpty(mode3) then print = "SSB4" else print = error end elseif mode2 == "sm" then if not mode3 == "short" then if mode4 == "3ds" then print = " Smash 3DS " elseif mode4 == "wiiu" then print = " Smash Wii U " elseif mode4 == "3dswiiu" or mode4 == "wiiu3ds" then print = " ''Smash 3DS / Wii U' " elseif isEmpty(mode4) then print = " Smash 4 " else print = error end elseif mode3 == "shorter" then if mode4 == "3ds" then print = " SSB:3DS " elseif mode4 == "wiiu" then print = " SSB:Wii U " elseif mode4 == "3dswiiu" or mode4 == "wiiu3ds" then print = " SSB:3DS/Wii U " elseif isEmpty(mode4) then print = " SSB4 " else print = error end elseif mode3 == "shortest" then if mode4 == "3ds" then print = " SSB:3DS " elseif mode4 == "wiiu" then print = " SSB:Wii U " elseif mode4 == "3dswiiu" or mode4 == "wiiu3ds" then print = " SSB:3DS/Wii U " elseif isEmpty(mode4) then print = " SSB4 " else print = error end elseif mode3 == "3ds" then if mode4 == "short" then print = " Smash 3DS " elseif mode4 == "shorter" then print = " SSB:3DS " elseif mode4 == "shortest" then print = " SSB:3DS " elseif isEmpty(mode4) then print = " Super Smash Bros. for Nintendo 3DS " else print = error end elseif mode3 == "wiiu" then if mode4 == "short" then print = " Smash Wii U " elseif mode4 == "shorter" then print = " SSB:Wii U " elseif mode4 == "shortest" then print = " SSB:Wii U " elseif isEmpty(mode4) then print = " Super Smash Bros. for Wii U " else print = error end elseif mode3 == "3dswiiu" or mode3 == "wiiu3ds" then if mode4 == "short" then print = " Smash 3DS / Wii U " elseif mode4 == "shorter" then print = " SSB:3DS/Wii U " elseif mode4 == "shortest" then print = " SSB:3DS/Wii U " elseif isEmpty(mode4) then print = " Super Smash Bros. for Nintendo 3DS / Wii U " else print = error end elseif isEmpty(mode3) then print = " Super Smash Bros. 4 " else print = error end elseif isEmpty(mode2) then print = "Super Smash Bros. 4" else print = error end elseif mode1 == "short" then if mode2 == "nolink" then if mode3 == "sm" then if mode4 == "3ds" then print = " Smash 3DS " elseif mode4 == "wiiu" then print = " Smash Wii U " elseif mode4 == "3dswiiu" or mode4 == "wiiu3ds" then print = " Smash 3DS / Wii U " elseif isEmpty(mode4) then print = " Smash 4 " else print = error end elseif mode3 == "3ds" then if mode4 == "sm" then print = " Smash 3DS " elseif isEmpty(mode4) then print = "Smash 3DS" else print = error end elseif mode3 == "wiiu" then if mode4 == "sm" then print = " Smash Wii U " elseif isEmpty(mode4) then print = "Smash Wii U" else print = error end elseif mode3 == "3dswiiu" or mode3 == "wiiu3ds" then if mode4 == "sm" then print = " Smash 3DS / Wii U " elseif isEmpty(mode4) then print = "Smash 3DS / Wii U" else print = error end elseif isEmpty(mode3) then print = "Smash 4" else print = error end elseif mode2 == "sm" then if mode3 == "nolink" then if mode4 == "3ds" then print = " Smash 3DS " elseif mode4 == "wiiu" then print = " Smash Wii U " elseif mode4 == "3dswiiu" or mode4 == "wiiu3ds" then print = " Smash 3DS / Wii U " elseif isEmpty(mode4) then print = " Smash 4 " else print = error end elseif mode3 == "3ds" then if mode4 == "nolink" then print = " Smash 3DS " elseif isEmpty(mode4) then print = " Smash 3DS " else print = error end elseif mode3 == "wiiu" then if mode4 == "nolink" then print = " Smash Wii U " elseif isEmpty(mode4) then print = " Smash Wii U " else print = error end elseif mode3 == "3dswiiu" or mode3 == "wiiu3ds" then if mode4 == "nolink" then print = " Smash 3DS / Wii U " elseif isEmpty(mode4) then print = " Smash 3DS / Wii U " else print = error end elseif isEmpty(mode3) then print = " Smash 4 " else print = error end elseif mode2 == "3ds" then if mode3 == "nolink" then if mode4 == "sm" then print = " Smash 3DS " elseif isEmpty(mode4) then print = "Smash 3DS" else print = error end elseif mode3 == "sm" then if mode4 == "nolink" then print = " Smash 3DS " elseif isEmpty(mode4) then print = " Smash 3DS " else print = error end elseif isEmpty(mode3) then print = "Smash 3DS" else print = error end elseif mode2 == "wiiu" then if mode3 == "nolink" then if mode4 == "sm" then print = " Smash Wii U " elseif isEmpty(mode4) then print = "Smash Wii U" else print = error end elseif mode3 == "sm" then if mode4 == "nolink" then print = " Smash Wii U " elseif isEmpty(mode4) then print = " Smash Wii U " else print = error end elseif isEmpty(mode3) then print = "Smash Wii U" else print = error end elseif mode2 == "3dswiiu" or mode2 == "wiiu3ds" then if mode3 == "nolink" then if mode4 == "sm" then print = " Smash 3DS / Wii U " elseif isEmpty(mode4) then print = "Smash 3DS / Wii U" else print = error end elseif mode3 == "sm" then if mode4 == "nolink" then print = " Smash 3DS / Wii U " elseif isEmpty(mode4) then print = " Smash 3DS / Wii U " else print = error end elseif isEmpty(mode3) then print = "Smash 3DS / Wii U" else print = error end elseif isEmpty(mode2) then print = "Smash 4" else print = error end elseif mode1 == "shorter" then if mode2 == "nolink" then if mode3 == "sm" then if mode4 == "3ds" then print = " SSB:3DS " elseif mode4 == "wiiu" then print = " SSB:Wii U " elseif mode4 == "3dswiiu" or mode4 == "wiiu3ds" then print = " SSB:3DS/Wii U " elseif isEmpty(mode4) then print = " SSB4 " else print = error end elseif mode3 == "3ds" then if mode4 == "sm" then print = " SSB:3DS " elseif isEmpty(mode4) then print = "SSB:3DS" else print = error end elseif mode3 == "wiiu" then if mode4 == "sm" then print = " SSB:Wii U " elseif isEmpty(mode4) then print = "SSB:Wii U" else print = error end elseif mode3 == "3dswiiu" or mode3 == "wiiu3ds" then if mode4 == "sm" then print = " SSB:3DS/Wii U " elseif isEmpty(mode4) then print = "SSB:3DS/Wii U" else print = error end elseif isEmpty(mode3) then print = "SSB4" else print = error end elseif mode2 == "sm" then if mode3 == "nolink" then if mode4 == "3ds" then print = " SSB:3DS " elseif mode4 == "wiiu" then print = " SSB:Wii U " elseif mode4 == "3dswiiu" or mode4 == "wiiu3ds" then print = " SSB:3DS/Wii U " elseif isEmpty(mode4) then print = " SSB4 " else print = error end elseif mode3 == "3ds" then if mode4 == "nolink" then print = " SSB:3DS " elseif isEmpty(mode4) then print = " SSB:3DS " else print = error end elseif mode3 == "wiiu" then if mode4 == "nolink" then print = " SSB:Wii U " elseif isEmpty(mode4) then print = " SSB:Wii U " else print = error end elseif mode3 == "3dswiiu" or mode3 == "wiiu3ds" then if mode4 == "nolink" then print = " SSB:3DS/Wii U " elseif isEmpty(mode4) then print = " SSB:3DS/Wii U " else print = error end elseif isEmpty(mode3) then print = " SSB4 " else print = error end elseif mode2 == "3ds" then if mode3 == "nolink" then if mode4 == "sm" then print = " SSB:3DS " elseif isEmpty(mode4) then print = "SSB:3DS" else print = error end elseif mode3 == "sm" then if mode4 == "nolink" then print = " SSB:3DS " elseif isEmpty(mode4) then print = " SSB:3DS " else print = error end elseif isEmpty(mode3) then print = "SSB:3DS" else print = error end elseif mode2 == "wiiu" then if mode3 == "nolink" then if mode4 == "sm" then print = " SSB:Wii U " elseif isEmpty(mode4) then print = "SSB:Wii U" else print = error end elseif mode3 == "sm" then if mode4 == "nolink" then print = " SSB:Wii U " elseif isEmpty(mode4) then print = " SSB:Wii U " else print = error end elseif isEmpty(mode3) then print = "SSB:Wii U" else print = error end elseif mode2 == "3dswiiu" or mode2 == "wiiu3ds" then if mode3 == "nolink" then if mode4 == "sm" then print = " SSB:3DS/Wii U " elseif isEmpty(mode4) then print = "SSB:3DS/Wii U" else print = error end elseif mode3 == "sm" then if mode4 == "nolink" then print = " SSB:3DS/Wii U " elseif isEmpty(mode4) then print = " SSB:3DS/Wii U " else print = error end elseif isEmpty(mode3) then print = "SSB:3DS/Wii U" else print = error end elseif isEmpty(mode2) then print = "SSB4" else print = error end elseif mode1 == "shortest" then if mode2 == "nolink" then if mode3 == "sm" then if mode4 == "3ds" then print = " SSB:3DS " elseif mode4 == "wiiu" then print = " SSB:Wii U " elseif mode4 == "3dswiiu" or mode4 == "wiiu3ds" then print = " SSB:3DS/Wii U " elseif isEmpty(mode4) then print = " SSB4 " else print = error end elseif mode3 == "3ds" then if mode4 == "sm" then print = " SSB:3DS " elseif isEmpty(mode4) then print = "SSB:3DS" else print = error end elseif mode3 == "wiiu" then if mode4 == "sm" then print = " SSB:Wii U " elseif isEmpty(mode4) then print = "SSB:Wii U" else print = error end elseif mode3 == "3dswiiu" or mode3 == "wiiu3ds" then if mode4 == "sm" then print = " SSB:3DS/Wii U " elseif isEmpty(mode4) then print = "SSB:3DS/Wii U" else print = error end elseif isEmpty(mode3) then print = "SSB4" else print = error end elseif mode2 == "sm" then if mode3 == "nolink" then if mode4 == "3ds" then print = " SSB:3DS " elseif mode4 == "wiiu" then print = " SSB:Wii U " elseif mode4 == "3dswiiu" or mode4 == "wiiu3ds" then print = " SSB:3DS/Wii U " elseif isEmpty(mode4) then print = " SSB4 " else print = error end elseif mode3 == "3ds" then if mode4 == "nolink" then print = " SSB:3DS " elseif isEmpty(mode4) then print = " SSB:3DS " else print = error end elseif mode3 == "wiiu" then if mode4 == "nolink" then print = " SSB:Wii U " elseif isEmpty(mode4) then print = " SSB:Wii U " else print = error end elseif mode3 == "3dswiiu" or mode3 == "wiiu3ds" then if mode4 == "nolink" then print = " SSB:3DS/Wii U " elseif isEmpty(mode4) then print = " SSB:3DS/Wii U " else print = error end elseif isEmpty(mode3) then print = " SSB4 " else print = error end elseif mode2 == "3ds" then if mode3 == "nolink" then if mode4 == "sm" then print = " SSB:3DS " elseif isEmpty(mode4) then print = "SSB:3DS" else print = error end elseif mode3 == "sm" then if mode4 == "nolink" then print = " SSB:3DS " elseif isEmpty(mode4) then print = " SSB:3DS " else print = error end elseif isEmpty(mode3) then print = "SSB:3DS" else print = error end elseif mode2 == "wiiu" then if mode3 == "nolink" then if mode4 == "sm" then print = " SSB:Wii U " elseif isEmpty(mode4) then print = "SSB:Wii U" else print = error end elseif mode3 == "sm" then if mode4 == "nolink" then print = " SSB:Wii U " elseif isEmpty(mode4) then print = " SSB:Wii U " else print = error end elseif isEmpty(mode3) then print = "SSB:Wii U" else print = error end elseif mode2 == "3dswiiu" or mode2 == "wiiu3ds" then if mode3 == "nolink" then if mode4 == "sm" then print = " SSB:3DS/Wii U " elseif isEmpty(mode4) then print = "SSB:3DS/Wii U" else print = error end elseif mode3 == "sm" then if mode4 == "nolink" then print = " SSB:3DS/Wii U " elseif isEmpty(mode4) then print = " SSB:3DS/Wii U " else print = error end elseif isEmpty(mode3) then print = "SSB:3DS/Wii U" else print = error end elseif isEmpty(mode2) then print = "SSB4" else print = error end elseif mode1 == "sm" then if mode2 == "nolink" then if mode3 == "short" then print = " ''" .. short .. "'' "				elseif mode3 == "shorter" then print = " " .. shorter .. " "				elseif mode3 == "shortest" then print = " " .. shortest .. " "				elseif isEmpty(mode3) then print = " ''" .. medium .. "'' "				else print = error end elseif not isEmpty(short) and mode2 == "short" then if mode3 == "nolink" then print = " ''" .. short .. "'' "				elseif isEmpty(mode3) then if not isEmpty(link) then print = " " .. linkindicator .. "" .. short .. " " else print = " " .. linkindicator .. "" .. short .. " " end else print = error end elseif not isEmpty(shorter) and mode2 == "shorter" then if mode3 == "nolink" then print = " " .. shorter .. " "				elseif isEmpty(mode3) then if not isEmpty(link) then print = " " .. linkindicator .. shorter .. " " else print = " " .. linkindicator .. shorter .. " " end else print = error end elseif not isEmpty(shortest) and mode2 == "shortest" then if mode3 == "nolink" then print = " " .. shortest .. " "				elseif isEmpty(mode3) then if not isEmpty(link) then print = " " .. linkindicator .. shortest .. " " else print = " " .. linkindicator .. shortest .. " " end else print = error end elseif isEmpty(mode2) then if not isEmpty(link) then print = " " .. linkindicator .. "" .. medium .. " " elseif not isEmpty(linkindicator) then print = " " .. linkindicator .. "" .. medium .. " " else print = " " .. medium .. " " end else print = error end else print = error end elseif isEmpty(mode1) then if not isEmpty(link) then print = "" .. linkindicator .. "" .. medium .. "" elseif not isEmpty(linkindicator) then print = "" .. linkindicator .. "" .. medium .. "" else print = "" .. medium .. "" end else print = error end return print end

return p