summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/luasrc/model/uci.lua
diff options
context:
space:
mode:
authorKarl Palsson <karlp@remake.is>2015-09-02 15:18:13 +0000
committerKarl Palsson <karlp@remake.is>2015-09-02 15:28:02 +0000
commit03786ed853fb2d538bd3448f778e9d0cfe50691e (patch)
treed5b36c9aab95c5385b3d930b40e9a3698c426699 /modules/luci-base/luasrc/model/uci.lua
parent879d9ff2b8f80b7c8e4adadf0702154d9ae932f4 (diff)
uci:get_list: always return a table, no matter what.
Previously, get_list("fake", "non-existent", "notreal") would still return a table, just empty. This is nice, as you can always iterate the returned table, without having to check it first. However, if you happened to pass a nil for any of the parameters, you would actually get a nil in return. This was inconsistent. The documentation is updated to clarify the behaviour of this function. Signed-off-by: Karl Palsson <karlp@remake.is>
Diffstat (limited to 'modules/luci-base/luasrc/model/uci.lua')
-rw-r--r--modules/luci-base/luasrc/model/uci.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/luci-base/luasrc/model/uci.lua b/modules/luci-base/luasrc/model/uci.lua
index e9bac6ec03..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)