Module:Logos

From TwogPedia
Revision as of 00:37, 8 October 2022 by Couchor (talk | contribs) (Created page with "local getArgs = require('Module:Arguments').getArgs local Logos = {} function Logos.main(frame) local args = getArgs(frame) local enteredLogos = {} local currentDate = os.date('%Y-%m-%d') for key, value in ipairs (args) do local values = mw.text.jsonDecode(value) if (values.start == nil or values.start < currentDate) and (values['end'] == nil or values['end'] > currentDate) then enteredLogos['all'] = values.logoAll enteredLogos['light'] = values.logoLigh...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

local getArgs = require('Module:Arguments').getArgs

local Logos = {}

function Logos.main(frame)
	local args = getArgs(frame)
	local enteredLogos = {}

	local currentDate = os.date('%Y-%m-%d')
	for key, value in ipairs (args) do
		local values = mw.text.jsonDecode(value)
		if (values.start == nil or values.start < currentDate) and (values['end'] == nil or values['end'] > currentDate) then
			enteredLogos['all'] = values.logoAll
			enteredLogos['light'] = values.logoLight
			enteredLogos['dark'] = values.logoDark
		end
	end
	return mw.text.jsonEncode(enteredLogos)
end

return Logos