[luci] luci Lua modules

Stephan Hennig sh-list at posteo.net
Thu Jan 14 20:55:33 CET 2016


Am 14.01.2016 um 20:41 schrieb Christian Schoenebeck:

> to handle Wifi inside LuCI you need to install libiwinfo-lua package.
> It's not automatically installed as dependency.
> Hope this help

Thanks, but that module is already installed here.

Speaking about wifi, what is the recommended way to retrieve available
wifi devices in Lua?  I'm currently doing something like this:

local iwinfo = require('iwinfo')
local luci_sys = require('luci.sys')
local function get_wifi_devices()
   local devices = {}
   -- Retrieve available network devices.
   for _, device in ipairs(luci_sys.net.devices()) do
      -- Is there iwinfo support for this network device?
      if iwinfo.type(device) then
         table.insert(devices, device)
      end
   end
   return devices
end

Is there any simpler way than iterating over all network devices?

Best regards,
Stephan Hennig



More information about the luci mailing list