Jump to content

Module:NYC bus link/sandbox

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Epicgenius (talk | contribs) at 22:38, 8 July 2018 (Create sandbox version of Module:NYC bus link). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
require('Module:No globals');
local getArgs = require('Module:Arguments').getArgs
local p = {}

function p.getLink(frame)
	local args = getArgs(frame);
	local city;
	
	if 'NYC' == args.city then
		city = 'New York City bus';
	elseif 'LI' == args.city then
		city = 'Long Island bus';
	elseif 'NJ' == args.city then
		city = 'New Jersey bus';
	end
		
	local result = {};
	for _, name in ipairs (args) do
		table.insert (result, table.concat ({'[[', name, ' (', city, ')|', name, ']]'}))
	end
	
	return table.concat (result, ', ');
end

return p;