What does the "Waypoint" variable do?

I get little confuse when I’m doing the challenge myself. Wasn’t sure what do I feed as key since there are “Waypoint” and “Index”. So I print them all out. “Index” changes as expected but “Waypoint” stay as zero all the time. I try to delete it and it fails when compile which is self-explanatory that the “Key” value is a reference, so it needs something to attach to work. Therefore, is it ok to say that the “Waypoint” variable only purpose is to make the function work? Or I simply miss some instructions?

I think I figured out my blind spot here. I didn’t put the type difference of these two variables into my mind. To put it in a translation of std::map in C++, “Waypoint” is a map which has object as value and integer as key. “Index” is another map which has integer as both value and key. The difference is the value of the “Index” map is exactly the key of “Waypoint”. In short, “Index”'s key leads to “Waypoint”'s key, then the Engine finds the matching value on blackboard. Both of them are essential.

Privacy & Terms