You mean data like this ? :
var racedata = {"redcar" :
{"lap1" : {"start" : Vector2 "end" Vector2, "time" :float}},
{ "lap2" : {"start" : Vector2 "end" Vector2, "time" :float}}},
{"bluecar" :
I would go for : (in pseudocode)
for CAR in racedata.keys():
var lapdata = racedata[CAR]
for LAP in lapdata.keys() :
var tweendata = lapdata[LAP]
$Tween.interpolate_property of CAR.position from tweendata["start"] to tweendata["end"] in tweendata["time"] seconds
Tween.start()
yield(Tween_finished)
This will animate all cars one after another. If You want to animate all cars simultanoulsy, You just need to make corroutine before iterating all cars in dictionary :
for CAR in racedata.keys():
animatelaps(racedata[CAR])
func animatelaps(lapdata):
for LAP in lapdata.keys() :
var tweendata = lapdata[LAP]
$Tween.interpolate_property of CAR.position from tweendata["start"] to tweendata["end"] in tweendata["time"] seconds
Tween.start()
yield(Tween_finished)