1
0
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:
Christian Hesse
2020-07-16 20:34:27 +02:00
parent 5859b0406e
commit 910641b6fa

View File

@ -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 ];