AI has no idea about Ros scripting. Not even the basics.
I suggest you use the built-in sorting of dictionary arrays:Output:What you have to do is:
- get the speed of an interface, ($speed)
- subtract it from a big enough number so that subtracting does not result in decreasing the number of digits ( something like :set speed (99999 - $speed) )
- collect data into a dictionary array (for example :set ($l->$speedstr) $interfacename ).
The result will be an array sorted by speed string, lower to higher. If you
Note: it i important to use string, otherwise you'll end up with a huge, number indexed array with lots of empty items.
I suggest you use the built-in sorting of dictionary arrays:
Code:
:global l ({}):set ($l->"c") "three":set ($l->"a") "one":set ($l->"b") "two":foreach k,v in=$l do={:put ("$k:$v")}
Code:
a:oneb:twoc:three
- get the speed of an interface, ($speed)
- subtract it from a big enough number so that subtracting does not result in decreasing the number of digits ( something like :set speed (99999 - $speed) )
- collect data into a dictionary array (for example :set ($l->$speedstr) $interfacename ).
The result will be an array sorted by speed string, lower to higher. If you
Note: it i important to use string, otherwise you'll end up with a huge, number indexed array with lots of empty items.
Statistics: Posted by A9691 — Fri Mar 28, 2025 8:52 am