While trying to code a small script I found a problem with “=” in associative arrays:
[admin@MikroTik] > :put ({"a"."b"=1;"b"."a"=2;"ab"=3});
false;false;ab=3
Basically, in an array, if the key is not a literal, the equal sign is taken as a comparison operator and it is impossible
to use.
My use case is for arrays that contain information abou ip addresses taken from address lists, code such as
:set ($addresses->"$addr") ({"$pt";"total"=1;"address"="$addr";})
Observe that, as I am only using one variable field, I can use the 0 to store it, as a workaround, but in the general case it is a big problem.
I wonder if there is alternative syntax, which is probably needed here…