Module:Jcon

local p = {} local insert = table.insert local getArgs = require('Module:Arguments').getArgs -- Import module function to work with passed arguments

function p.jcon(frame) local args = getArgs(frame) local type = args[1] if not type then return end local route1 = args[2] if not route1 then return end local route2 = args.con local route3 = args.con2 local jconData = mw.loadData("Module:Jcon/data") local jctType = jconData.types[type] or 'County' local region = jconData.regions[type] or type local jctData = {jctType, route1, province = "ON"} jctData.dir1 = args.dir jctData.county1 = region if route2 then jctData[3] = jctType jctData[4] = route2 jctData.dir2 = args.condir jctData.county2 = region end if route3 then jctData[5] = jctType jctData[6] = route3 jctData.dir3 = args.condir2 jctData.county3 = region end jctData.name1 = args[3] local locations = {} insert(locations, args.city) insert(locations, args.city2) insert(locations, args.town) insert(locations, args.town2) for i,v in ipairs(locations) do jctData["city" .. i] = v	end jctData.noshield = args.nosh jctData.nolink = args.nolink local jctModule = require "Module:Jct" return jctModule._jct(jctData) end

return p