-
--- Level 2 (sections)
-function sections_mt.__index(self, key)
- local node = rawget(self, key)
- if not node then
- node = {}
- node[".conf"] = self[".name"]
- node[".name"] = key
- node[".type"] = uci.get(self[".name"], key)
- setmetatable(node, options_mt)
- rawset(self, key, node)
- end
- return node
-end
-function sections_mt.__newindex(self, key, value)
- if not value then
- if uci.delete(self[".name"], key) then
- rawset(self, key, nil)
- else
- error("unable to delete section")
- end
- elseif key == "" then
- key = uci.add(self[".name"], tostring(value))
- if key then
- rawset(self, "", self[key])
- else
- error("unable to create section")
- end
+function section(config, type, name, values)
+ local stat = true
+ if name then
+ stat = set(config, name, type)