mirror of
https://github.com/wifinigel/MikrotikScripting.git
synced 2025-07-15 04:24:30 +02:00
update for v6/v7 support
This commit is contained in:
parent
4871e9432b
commit
b10b99bd87
120 changed files with 1479 additions and 22 deletions
|
@ -1,39 +0,0 @@
|
|||
# filename: ch9-02-multiple-args-simple.rsc
|
||||
|
||||
# Let's create function to receive multiple args
|
||||
|
||||
# --- start of function ---
|
||||
:global PrintInterfaceAttrsFunc do={
|
||||
|
||||
:local InterfaceName $1;
|
||||
:local InterfaceSpeed $2;
|
||||
:local InterfaceIp $3;
|
||||
|
||||
# check args are correct data types
|
||||
if ([:typeof $InterfaceName] != "str") do={
|
||||
:error "Interface name argument not a string!";
|
||||
}
|
||||
|
||||
if ([:typeof $InterfaceSpeed] != "str") do={
|
||||
:error "InterfaceSpeed argument not a string!";
|
||||
}
|
||||
|
||||
if ([:typeof $InterfaceIp] != "str") do={
|
||||
:error "Interface IP argument not a string!";
|
||||
}
|
||||
|
||||
# data type checks passed, print the interface data
|
||||
:put "$InterfaceName: IP address = $InterfaceIp, speed = $InterfaceSpeed";
|
||||
|
||||
}
|
||||
# --- end of function ---
|
||||
|
||||
# Let's call the function with some sample values ($1, $2, $3)
|
||||
$PrintInterfaceAttrsFunc "WAN1" "100Mbps" "192.168.99.1/24";
|
||||
|
||||
# Let's call the function with some other values ($1, $2, $3)
|
||||
$PrintInterfaceAttrsFunc "ether2-LAN" "1000Mbps" "172.16.1.254/24";
|
||||
|
||||
# Cleanup global namespace
|
||||
:set PrintInterfaceAttrsFunc;
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue