Jump to content

Module:Sandbox/BrandonXLF/4

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by BrandonXLF (talk | contribs) at 06:40, 24 August 2024. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

-- Sandbox, do not delete
local p = {}

local roadDataModule = require("Module:Road data/sandbox") -- REMOVE SANDBOX

function p._shieldmain(args, frame)
	frame = frame or mw.getCurrentFrame()
	
	local shields = {}
	local routeCount = 1
	
	while args[routeCount * 2 - 1] do
		local routeType = args[routeCount * 2 - 1]

		local route = {
			country = args['country' .. routeCount] or args.state,
			state = args['state' .. routeCount] or args.state,
			type = routeType,
			route = args[routeCount * 2]
		}
		
		if not route.country then
			local countryModule = mw.loadData('Module:Road data/countrymask')
			route.country = countryModule[route.state] or 'UNK'
		end

		insert(shields, roadDataModule.shield(route, 'main', 'infobox', true))
		routeCount = routeCount + 1
	end

	return concat(shields, ' ')
end

function p.shieldmain(frame)
	local args = require('Module:Arguments').getArgs(frame)
	return p._shieldmain(args, frame)
end

return p