getting host-name from hotspot onlogin

hi there!
I’m trying to get the hostname from the user when loggin to my hotspot, the script is running in the onlogin propertie,
my approach :

:local pc;
:set pc [/ip dhcp-server lease get $"mac-address" host-name];
:log info "computer name:$pc"

any idea where can I be wrong… :confused:

I found the solution, the right way is:

:local mac;
:local host;
:set mac $"mac-address";
:set host [ip/ dhcp-server lease get [ find mac-address=$mac ] host-name ];
:log info "the host-name is $host"

what I am wondering is why can’t use $“mac-address” in first place instead of parsing it to another variable, anyway this works for me!