How to get wp coordinates in lua

Hi everyone, the pixhawk has a single wp uploaded. Using lua script so I can get the wp coordinates?
I would like to do with a programmer friend that the boat starts in auto mode towards the one single wp and meanwhile retrieves its current position and as it approaches wp it finds out when it got into wp, then two servos work, then change mode RTL.
We can’t find documentation on how to get wp coordinates.
We tried get_taget_location but it doesn’t work. The rest of the script works, the current position prints the lat and long coordinates
Please help me.