Pumunta sa nilalaman

Module:Jct/city/sandbox

Mula sa Wikipedia, ang malayang ensiklopedya

Kamalian ng Lua na sa Module:Documentation na nasa linyang 388: message: type error in message cfg.module-sandbox-category (string expected, got nil).

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