X-Git-Url: http://git.archive.openwrt.org/?a=blobdiff_plain;f=modules%2Fluci-base%2Fluasrc%2Fmodel%2Fuci.lua;h=0e3950c0bd5158c534fe51a29b1df57d30ffa2fd;hb=b4040aacb04ce38b7eae315d37b2a61a38aea4b1;hp=bbd9b4cfbf25b9bfe54513d5f1ba19aca326a3d3;hpb=9dcf73b323fa97534a931e3acfbab8b03ce3961f;p=project%2Fluci.git diff --git a/modules/luci-base/luasrc/model/uci.lua b/modules/luci-base/luasrc/model/uci.lua index bbd9b4cfb..0e3950c0b 100644 --- a/modules/luci-base/luasrc/model/uci.lua +++ b/modules/luci-base/luasrc/model/uci.lua @@ -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, @@ -234,7 +242,7 @@ end function get_first(self, config, stype, option, default) local rv = default - self:foreach(conf, stype, function(s) + self:foreach(config, stype, function(s) local val = not option and s[".name"] or s[option] if type(default) == "number" then