luci-base: implement luci.model.uci.get_state()
[project/luci.git] / modules / luci-base / luasrc / model / uci.lua
index bbd9b4c..7e1c8f5 100644 (file)
@@ -182,11 +182,11 @@ function foreach(self, config, stype, callback)
        end
 end
 
-function get(self, config, section, option)
+local function _get(self, operation, config, section, option)
        if section == nil then
                return nil
        elseif type(option) == "string" and option:byte(1) ~= 46 then
-               local rv, err = util.ubus("uci", "get", {
+               local rv, err = util.ubus("uci", operation, {
                        config  = config,
                        section = section,
                        option  = option
@@ -211,6 +211,14 @@ function get(self, config, section, option)
        end
 end
 
+function get(self, ...)
+       return _get(self, "get", ...)
+end
+
+function get_state(self, ...)
+       return _get(self, "state", ...)
+end
+
 function get_all(self, config, section)
        local rv, err = util.ubus("uci", "get", {
                config  = config,