mirror of
https://github.com/nymurbd/MikroTik-scripts.git
synced 2025-07-31 16:24:30 +02:00
global-functions: introduce $IfThenElse
This commit is contained in:
parent
5859b0406e
commit
910641b6fa
1 changed files with 9 additions and 0 deletions
|
@ -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 ];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue