Convert a vector2 position to an array index in Curve2D

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By estebanmolca

To move a point in curve2d in game use:
path.curve.set_point_position (2, get_local_mouse_position ())
With this function I move the point at index 2 of the curve with the mouse, but what I want to do, instead of moving point 2, is to move the point closest to the mouse.
This is the function:
get_closest_point (to_point: Vector2)
But this function returns a vector2 with the coordinates of the point. What I want is to return your index number in the array. What am I missing here, any ideas?