Code: Select all
function findshortestroad(index, value, distance)
distance = distance + 1
foreach(location.neighbors, findshortestroad(distance)
endfunction
distance = 0
foreach(location.neighbors, findshortestroad(distance))
But just to give you the idea, that this way it would be easy to know the distance from current place. But is there any way to do this? For to my understanding using foreach command doesnt let you pass any arguments to the function to be executed?
And if not possible, then please add support for userdata or something to foreach commands to be executed functions.