OpenWrt Forum Archive

Topic: Trying to understand wifi.lua in LuCI for OpenWrt

The content of this topic has been archived on 5 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I was reading the wifi.lua file:

http://luci.subsignal.org/trac/browser/ … k/wifi.lua

Line 18 says:
    local nt = require "luci.sys".net
which I assume to be using a library of functions in luci.sys.net.

I thought it is strange that the double quotes ended before the end of the word. Is it the same as:
    local nt = require "luci.sys.net"

Line 21 says:
arg[1] = arg[1] or ""

Where does the arg[1] come from?

arg[1] is a argument, it comes from the post data iirc

It is a shortcut for

local lib = require("luci.sys")
local nt = lib.net

As for arg[1] - this is an argument passed to the module by dispatcher.lua, it contains radio the page is operating on.

Thanks FZ and jow for the advice.

(Last edited by lion on 10 Sep 2013, 09:52)

The discussion might have continued from here.