mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2024-05-11 05:55:19 +00:00
global-functions: introduce $IfThenElse
This commit is contained in:
@ -27,6 +27,7 @@
|
||||
:global GetMacVendor;
|
||||
:global GetRandomNumber;
|
||||
:global GetRandomSha256;
|
||||
:global IfThenElse;
|
||||
:global IPCalc;
|
||||
:global LogPrintExit;
|
||||
:global MailServerIsUp;
|
||||
@ -339,6 +340,14 @@
|
||||
:return $FingerPrint;
|
||||
}
|
||||
|
||||
# mimic conditional/ternary operator (condition ? consequent : alternative)
|
||||
:set IfThenElse do={
|
||||
:if ([ :tostr $1 ] = "true" || [ :tobool $1 ] = true) do={
|
||||
:return $2;
|
||||
}
|
||||
:return $3;
|
||||
}
|
||||
|
||||
# calculate and print netmask, network, min host, max host and broadcast
|
||||
:set IPCalc do={
|
||||
:local Input [ :tostr $1 ];
|
||||
|
Reference in New Issue
Block a user