well since your path will always be a circle, use path_nextnode to check wether or not the next node is 1 (1 is the first node). So if the result of path_nextnode == 1, then the current node is the last one.
Click and join the 3dgs irc community! Room: #3dgs