Sort Middleware Source ​
lua
telem.middleware.sort ()
Sorts the metrics in a collection by name.
Usage ​
lua
local telem = require 'telem'
local mw = telem.middleware
local backplane = telem.backplane()
:addInput('elements', telem.input.custom(function ()
return {
fire = 111,
water = 222,
earth = 333,
air = 444,
}
end))
:middleware(mw.sort())
:cycleEvery(1)()
This will modify the collection to be sorted alphabetically by name:
Name | Value | Unit |
---|---|---|
air | 444 | |
earth | 333 | |
fire | 111 | |
water | 222 |