[luci] luci grammar

子文 u8j9 at 163.com
Tue Jun 17 06:36:05 CEST 2014


Dear
   uci:foreach("network", "interface",
        function (section)
            local ifc = section[".name"]
            if ifc ~= "loopback" then
                entry({"admin", "network", "network", ifc},
                 true,
                 ifc:upper())
            end
        end
    )
      Sorry  , I can't still understand the setence " local ifc = section[".name"]", why can it get the section name by using section[".name"]"?










At 2014-06-17 00:48:28, "Jo-Philipp Wich" <xm at subsignal.org> wrote:
>Hi,
>
>no the field is actually called ".name" so you cannot use the dot
>notation as ".name" is not a valid label, neither in Lua nor in JSON or
>JavaScript.
>
>In pseudo code it is accessing section(dot)(dot)name, not
>section(dot)name - hence the bracket notation.
>
>Cheers,
>Jow
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsignal.org/pipermail/luci/attachments/20140617/440e736b/attachment.html>


More information about the luci mailing list