Finding public IP

I did find a in a script how to find public IP on RouterOS

:put [/ip address get [find interface="ether1"] address];

My problem is that the outside interface may be named something other than ether1.

So after som testing I come up with this:

:put [/ip address get [find interface=[/ip route get [find dst-address=0.0.0.0/0] vrf-interface]] address]

[/ip route get [find dst-address=0.0.0.0/0] vrf-interface]
This should find the interface name on the interface with route sending you to internet.

Anyone see anything wrong with this?
Will it work with all MT?