summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/luasrc/model/uci.lua
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2015-12-17 02:39:23 +0100
committerJo-Philipp Wich <jow@openwrt.org>2015-12-17 02:39:23 +0100
commit967bb1f36f9f30d19e13aecf3a550eea5fd73c6b (patch)
tree253ae8cee5f3e8aa8dc2a40efdc677f25188bf41 /modules/luci-base/luasrc/model/uci.lua
parent0dcb549841edc951646e90eda6956399aea7c209 (diff)
parent03786ed853fb2d538bd3448f778e9d0cfe50691e (diff)
Merge pull request #464 from remakeelectric/pulls/list-operations
get/set list operations and documentation
Diffstat (limited to 'modules/luci-base/luasrc/model/uci.lua')
-rw-r--r--modules/luci-base/luasrc/model/uci.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/luci-base/luasrc/model/uci.lua b/modules/luci-base/luasrc/model/uci.lua
index 1659137742..577c6cde08 100644
--- a/modules/luci-base/luasrc/model/uci.lua
+++ b/modules/luci-base/luasrc/model/uci.lua
@@ -111,7 +111,7 @@ function Cursor.get_list(self, config, section, option)
local val = self:get(config, section, option)
return ( type(val) == "table" and val or { val } )
end
- return nil
+ return {}
end
function Cursor.get_first(self, conf, stype, opt, def)
@@ -139,6 +139,9 @@ end
function Cursor.set_list(self, config, section, option, value)
if config and section and option then
+ if not value or #value == 0 then
+ return self:delete(config, section, option)
+ end
return self:set(
config, section, option,
( type(value) == "table" and value or { value } )