A shared function that returns the nearest waypoint to the given position.
The found waypoint. Nil if it's not found. See Waypoint Structure.
The ID of the found waypoint. Can also be nil if it's not found.
Gets the nearest waypoint to the player and prints its position and ID.
Gets the nearest waypoint of group #1 by using a filter function.
Result
waypoint.Group will be 1 or 0.