Module:Infobox road/name

local p = {}

local names = {} do function names:name(args) local country = self:country(args.country) return country and country:name(args) or '' end function names:country(name) local module = require(string.format("Module:Infobox road/name/%s", name)) return module.names end end

p.names = names

function p._name(args) return names:name(args) end

function p.name(frame) local pframe = frame:getParent local config = frame.args -- the arguments passed BY the template, in the wikitext of the template itself local args = pframe.args -- the arguments passed TO the template, in the wikitext that transcludes the template local function emptyParam(param) local empty = {[''] = true, ['¬'] = true} if empty[param] then return nil else return param end end local state = config.state or args.state state = emptyParam(state) local province = config.province or args.province province = emptyParam(province) local type = config.type or args.type local subtype = config.subtype or args.subtype or nil local route = args.num or args.route or config.route or config.num or "" local country = config.country or args.country return p._name{country=country, state=state, province=province, type=type, route=route, subtype=subtype} end

return p