Community discussions

MikroTik App
Topic Author
Posts: 36
Joined: Sat Aug 03, 2013 4:29 am

Scripting Mikrotik how passing variables for reference to functions

Sun May 29, 2016 5:07 am

Hi, I read in the Manual:Scripting about functions and functions in files. So I was using with files with script environment, but I have a problem, I need change the value of two variables that I have

This is the sample of the Mikrotik help

Caller File named CallmyScript
:global myVar "world"
:global myFunc [:parse [/system script get myScript source]]
$myFunc myVar
:put "The value of myVar variable was changed into myScript but vale not was changed here '$myVar'"
File called myScript
:put "Hello $myVar "
:set $myVar  "changed value"
Using global variables neither work.

Is posible to do this or similar? I can get one value from myScript with :return but I ned more values that oly one.

In other language that c is possible do it passing the variables for reference not for value, is possibe do this with the & and the * symbols in the name of the variable.


Who is online

Users browsing this forum: faxxe and 173 guests