Lompat ke isi

Modul:Jct/city/Chinissai

Dari Wikipedia bahasa Indonesia, ensiklopedia bebas

local p = {}

local concat = table.concat
local insert = table.insert
local format = mw.ustring.format

local roadDataModule = require("Module:Road data")

local function location(args, num)
	return roadDataModule.locations({
		country = args.country,
		state = args.state or args.province,
		sub1name = "County", -- TODO transition
		sub2_special = args["location" .. num],
		sub2 = args["city" .. num],
		area = args["areadab" .. num],
		sub1dab = args["countydab" .. num]
	}, "jct").sub2
end

function p.city(args)
	local cities = {}
	local locationCount = 1
	while args['city' .. locationCount] or args['location' .. locationCount] do
		insert(cities, location(args, locationCount))
		locationCount = locationCount + 1
	end
	return concat(cities, ', ')
end

return p