Module:Sandbox/Pizza1016/Victoria infobox station name formatting

local p = {}

function p.format( frame ) local args = frame.args -- expects a sequence of strings local lines = require("Module:Adjacent stations/Metro Trains Melbourne").lines local vlines = require("Module:Adjacent stations/V/Line").lines local result = {} local colours = {} -- colours to display local keyset = {} -- to avoid duplicating colours -- Obtain all unique colours first, in order of argument input local i = 1 local j = 1 while args[i] do		if lines[args[i]] then local current = lines[args[i]].color if current and not keyset[current] then colours[j] = current keyset[current] = true j = j + 1 end elseif args[i] == "V/Line" or vlines[args[i]] then if not keyset["7f0d82"] then colours[j] = "7f0d82" keyset["7f0d82"] = true j = j + 1 end else error("Line \"" .. args[i] .. "\" does not exist", 2) end i = i + 1 end -- Now generate the format string for j = 1, ( #colours - 1 ) do		table.insert( result, 1, table.concat( { "" } ) )		table.insert( result, " " ) end table.insert( result, 1, table.concat( { "" } ) )	table.insert( result, " " )

return table.concat(result) end

return p