Community discussions

MikroTik App
macdo
刚刚加入了
Topic Author
Posts: 14
加入: Tue Sep 05, 2017 3:48 am

Name var " dynamic "

Tue Sep 05, 2017 3:58 am

This is possible

:global prb1 123;
:local a 1; :put $prb.$a;

I'm doing a loop in which it traverses several variables but I can not dynamically create the names of those variables with the loop counter



I thank the possible help they can give me
Top
用户头像
mrz
MikroTik Support
MikroTik Support
Posts: 6956
加入: Wed Feb 07, 2007 12:45 pm
Location:Latvia
Contact:

Re: Name var " dynamic "

Tue Sep 05, 2017 1:03 pm

Dynamic variable names are not possible.
Top
macdo
刚刚加入了
Topic Author
Posts: 14
加入: Tue Sep 05, 2017 3:48 am

Re: Name var " dynamic "

Thu Sep 07, 2017 5:32 am

thanks friend for your answer
Top
用户头像
BlackVS
Member Candidate
Member Candidate
Posts: 171
加入: Mon Feb 04, 2013 7:00 pm
Contact:

Re: Name var " dynamic "

Thu Sep 07, 2017 7:54 am

Code:Select all
:global prb1 123 :global prb2 1234 :global prb3 12345 :local a1 1; :local a2 2; :local a3 3; :global t :execute script=":global t \$prb$a1" :put $t :execute script=":global t \$prb$a2" :put $t :execute script=":global t \$prb$a3" :put $t
Top
macdo
刚刚加入了
Topic Author
Posts: 14
加入: Tue Sep 05, 2017 3:48 am

Re: Name var " dynamic "

Fri Sep 29, 2017 8:46 pm

Code:Select all
:global prb1 123 :global prb2 1234 :global prb3 12345 :local a1 1; :local a2 2; :local a3 3; :global t :execute script=":global t \$prb$a1" :put $t :execute script=":global t \$prb$a2" :put $t :execute script=":global t \$prb$a3" :put $t
Excellent
Top

Who is online

Users browsing this forum:Ahrefs [Bot]and 8 guests