aboutsummaryrefslogtreecommitdiffstats
path: root/global-functions.d/inspectvar
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2021-11-15 20:22:56 +0100
committerGravatar Christian Hesse <mail@eworm.de>2021-11-15 22:18:10 +0100
commit8fc88c73f8cb99774727e7b96f9b85a8bf216c2c (patch)
treee5a36de5fd846a210088b2a21bd436f3f53b4805 /global-functions.d/inspectvar
parentf484e45b6a1fe5284462da19c90219d0716d916a (diff)
shorten modules directory name (global-functions.d -> mod)change-67
Diffstat (limited to 'global-functions.d/inspectvar')
-rw-r--r--global-functions.d/inspectvar40
1 files changed, 0 insertions, 40 deletions
diff --git a/global-functions.d/inspectvar b/global-functions.d/inspectvar
deleted file mode 100644
index 15da04a..0000000
--- a/global-functions.d/inspectvar
+++ /dev/null
@@ -1,40 +0,0 @@
-#!rsc by RouterOS
-# RouterOS script: global-functions.d/inspectvar
-# Copyright (c) 2020-2021 Christian Hesse <mail@eworm.de>
-# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
-
-:global InspectVar;
-
-# inspect variable
-:set InspectVar do={
- :local Input $1;
- :local Level (0 + [ :tonum $2 ]);
-
- :global InspectVar;
-
- :local PutIndent do={
- :local Prefix [ :tostr $1 ];
- :local Value [ :tostr $2 ];
- :local Level [ :tonum $3 ];
-
- :local Indent "";
- :for I from=1 to=$Level step=1 do={
- :set Indent ($Indent . " ");
- }
- :put ($Indent . "-" . $Prefix . "-> " . $Value);
- }
-
- :local TypeOf [ :typeof $Input ];
- $PutIndent "type" $TypeOf $Level;
-
- :if ($TypeOf = "array") do={
- :foreach Key,Value in=$Input do={
- $PutIndent "key" $Key ($Level + 1);
- $InspectVar $Value ($Level + 2);
- }
- } else={
- :if ($TypeOf != "nothing") do={
- $PutIndent "value" $Input $Level;
- }
- }
-}