Broken down, it works like this.
local dev
Not really needed, but I'd imagine you know it creates local variable dev
.
for _, dev in ipairs(devices) do
Loops through indexed table devices
, and stores the value into dev
locally.
local net
Again, not really needed.
for _, net in ipairs(dev:get_wifinets()) do
dev
uses the function get_wifinets()
, which in turns returns an indexed table for which net
loops through as the value.
netlist[#netlist+1] = net:id()
This uses the id()
function on the value net
from the table returned with get_wifinets()
and stores it as the last element in the netlist
table.
netdevs[net:id()] = dev:name()
Since we are still within the scope of the dev
value loop, this takes the name()
function of the dev
value and stores it to the table listed, whether indexed or dictionary.
Hopefully this helps answer your question.