LUA/API Command for Distance to Waypoint?

Trying to make a macro to tell me the distrance from my player to my currently set waypoint.

I’m using this right now but it only returns zero

/run local x=C_Navigation.GetDistance(waypoint0);SendChatMessage(x)

By waypoint i mean the default pin you can put on map by pressing ctrl+click.

UPDATE:
I answered my own question, incase anyone else needs:

/run local d=C_Navigation.GetDistance(“Map Pin”); if (d <= 40) then …