mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-07-08 00:54:29 +02:00
global-functions: introduce $EitherOr
This commit is contained in:
parent
66a92c3da9
commit
e97b394536
1 changed files with 11 additions and 0 deletions
|
@ -24,6 +24,7 @@
|
||||||
:global DeviceInfo;
|
:global DeviceInfo;
|
||||||
:global DNSIsResolving;
|
:global DNSIsResolving;
|
||||||
:global DownloadPackage;
|
:global DownloadPackage;
|
||||||
|
:global EitherOr;
|
||||||
:global EscapeForRegEx;
|
:global EscapeForRegEx;
|
||||||
:global FlushEmailQueue;
|
:global FlushEmailQueue;
|
||||||
:global FlushTelegramQueue;
|
:global FlushTelegramQueue;
|
||||||
|
@ -293,6 +294,16 @@
|
||||||
:return false;
|
:return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# return either first (if "true") or second
|
||||||
|
:set EitherOr do={
|
||||||
|
:global IfThenElse;
|
||||||
|
|
||||||
|
:if ([ :typeof $1 ] = "num") do={
|
||||||
|
:return [ $IfThenElse ($1 != 0) $1 $2 ];
|
||||||
|
}
|
||||||
|
:return [ $IfThenElse ([ :len [ :tostr $1 ] ] > 0) $1 $2 ];
|
||||||
|
}
|
||||||
|
|
||||||
# escape for regular expression
|
# escape for regular expression
|
||||||
:set EscapeForRegEx do={
|
:set EscapeForRegEx do={
|
||||||
:local Input [ :tostr $1 ];
|
:local Input [ :tostr $1 ];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue