Community discussions

MikroTik App
 
mknnoc
Trainer
Trainer
Topic Author
Posts: 229
Joined: Thu Feb 28, 2008 6:40 am
Location: cambodia

Is it possible to write a funcation + Arg in mikrotik ?

Mon Oct 04, 2010 11:57 am

Is it possible to write a funcation + Arg in Mikrotik scripting?
if yes, please show me a very simple example.

Thanks,
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7053
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Is it possible to write a funcation + Arg in mikrotik ?

Mon Oct 04, 2010 12:09 pm

It is not possible to define functions in ROS. However there are some workarounds:
*) http://wiki.mikrotik.com/wiki/Use_Funct ... CMD_Script
*) use :parse command
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: Is it possible to write a funcation + Arg in mikrotik ?

Mon Oct 04, 2010 1:40 pm

The scripts run concurrently. If you want to run scripts as a subroutine, and use the values generated by the subroutine, you must wait for the called script to finish before using the variables. Here is a link to a thread that has the code to make the main routine "wait" for the subroutine to finish. The code description starts with my post, about five from the start.
http://forum.mikrotik.com/viewtopic.php?f=9&t=39312

Who is online

Users browsing this forum: Google [Bot] and 22 guests