Get variable from registration-table problem

Hello,

I have written a very small script a while ago and it was working properly in v5. Or maybe I didn’t try it well enough. But here is the problem :

:local currentip [/interface wireless registration-table get [find where mac-address=$clientmac] value-name=last-ip];

This part of the script should get the last-ip of an entry in the registration table and that works. It does get the ip address.
But it works correctly only if this mac address is present in the registration table.
I think that when ‘find where’ statement is not fulfilled it should return a blank string, but instead it takes the ‘last-ip’ of the first result from the table and assigns it to the variable.
Can anyone tell me why is this behaving this way and maybe a way to fix it ?

P.S. I am pretty certain that I did some tests for the case that this mac is not present back in v5, because I am checking for blank string later in the script :

… and [:len $currentip] > 0

Now the board is using latest v6.7 routeros

If you paste this into a terminal with an an existing MAC, it should return 1, and a non-existing should return 0.
:put [:len [/interface wireless registration-table find where mac-address=00:0C:42:12:34:56]]So then, you could change your script to first check to see if that MAC exists in the table, and then proceed with doing whatever else. Something like:
:if ([:len [/interface wireless registration-table find where mac-address=$clientmac]] = 1) do={
… do stuff
} else={
/log info “$clientmac MAC not found…”
}

Thank you. I got the idea and put this solution in the script. Now it is working as intended.
But it is strange why it does that. This was not the case in previous versions. The command I posted returned a blank string.