Community discussions

MikroTik App

Search found 2 matches

by iamarpit
Fri Nov 26, 2021 4:41 pm
Forum: Scripting
Topic: [SOLVED] Using Dynamic Variable Names
Replies: 40
Views: 36901

Re: Using Dynamic Variable Names

You just need square brackets: foreach varname in={"VAR1"; "VAR2"; "VAR3"} do={[parse "global $varname true"]} yeah but this doesn't work in this setting, if you put space in the values foreach key,value in={"VAR1"="foo with space"; "...
by iamarpit
Fri Nov 26, 2021 4:11 pm
Forum: Scripting
Topic: define globals by iterating array
Replies: 0
Views: 2442

define globals by iterating array

Hi, I am new to scripting I was wondering if there is a way to define globals from an array something like this.. :global env { "foo"="bar"; "foo2"="bar"; "baz"="foo" } :foreach key,value in=$env do={ :global $key $value } I tried that but ...