Documentation for this module may be created at Module:Which Round/doc
local data = require("Module:Which_Round/data")
local episodes = data[1]
local chapters = data[2]
---@return string
function episodes.find(self, num)
for _, v in pairs(self) do
if type(v) == "table" then
if num >= v[1] and num <= v[2] then
return v[3]
end
end
end
return ""
end
---@return string
function chapters.find(self, num)
for _, v in pairs(self) do
if type(v) == "table" then
if num >= v[1] and num <= v[2] then
return v[3]
end
end
end
return ""
end
local mod = {
episodes = episodes,
chapters = chapters
}
---@type Util
local util = require('Module:Util')
---@param frame frame
function mod.which_round(frame)
local args, pargs = util.get_args_and_pargs(frame)
local num = args[1] or pargs[1] or ""
local variant = args[2] or pargs[2] or ""
local d = {}
if variant == "episodes" then d = episodes else d = chapters end
local n = tonumber(num) or #d
return d:find(n)
end
return mod