Quantcast
Channel: MikroTik
Viewing all articles
Browse latest Browse all 15394

Scripting • Re: Add array element inside for / foreach

$
0
0
Close. You need to declare the outer array & use parens+comma to concat values to the array.

:global interfaces [:toarray ""]

:foreach i in=[/interface bridge port find where pvid=80] do={
:local bport [/interface bridge port get number=$i];
:put ($bport->"interface");
:set $interfaces ($interfaces,$bport);
}

Statistics: Posted by Amm0 — Sun Dec 31, 2023 10:54 pm



Viewing all articles
Browse latest Browse all 15394

Trending Articles