Leaguepedia | League of Legends Esports Wiki
Advertisement
Leaguepedia | League of Legends Esports Wiki

Documentation for this module may be created at Module:MatchDayLookup/doc

local util_args = require('Module:ArgsUtil')
local util_cargo = require("Module:CargoUtil")
local util_esports = require("Module:EsportsUtil")
local util_html = require("Module:HtmlUtil")
local util_map = require('Module:MapUtil')
local util_table = require("Module:TableUtil")
local util_text = require("Module:TextUtil")
local util_vars = require("Module:VarsUtil")
local i18n = require("Module:I18nUtil")
local lang = mw.getLanguage('en')
local h = {}
local p = {}
function p.init()
	local query = {
		tables = { 'MatchSchedule=MS' },
		fields = {
			'MS.MatchDay[number]',
			'MS.MatchId',
		},
		where = {
			('MS.OverviewPage="%s"'):format(util_esports.getOverviewPage()),
		},
	}
	local result = util_cargo.getConstDict(query, 'MatchId', 'MatchDay')
	h.set(result)
end

function p.disable()
	h.doDisable()
end

function p.lookup(matchId)
	if h.isDisabled() then return nil end
	local dict = h.get()
	if not dict then return nil end
	return dict[matchId]
end

function h.set(val)
	util_vars.setObject('matchDayObj', val)
end

function h.get()
	return util_vars.getObject('matchDayObj')
end

function h.doDisable()
	util_vars.setBool('matchDayDisable', true)
end

function h.isDisabled()
	return util_vars.getBool('matchDayDisable')
end

return p
Advertisement