Page 1 of 1

Scripting Mikrotik how passing variables for reference to functions

Posted: Sun May 29, 2016 5:07 am
by javierc
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.

Regards