lua: simplify destination helper

This commit is contained in:
Emil Tin 2016-11-17 00:33:44 +01:00 committed by Patrick Niklaus
parent 00f7d7776d
commit f5bf788814

View File

@ -12,21 +12,17 @@ function Destination.get_directional_tag(way, is_forward, tag)
end
end
function Destination.join(a,b)
if a and b then
return a .. ': ' .. b
else
return a or b
end
end
-- Assemble destination as: "A59: Düsseldorf, Köln"
-- destination:ref ^ ^ destination
function Destination.get_destination(way, is_forward)
destination_ref = Destination.get_directional_tag(way, is_forward, 'destination:ref')
destination = Destination.get_directional_tag(way, is_forward, 'destination')
return Destination.join(destination_ref, destination) or ''
ref = Destination.get_directional_tag(way, is_forward, 'destination:ref')
dest = Destination.get_directional_tag(way, is_forward, 'destination')
if ref and dest then
return ref .. ': ' .. dest
else
return ref or dest or ''
end
end
return Destination