lua-simple-uci: delete option when using Cursor:set() with nil value
Setting the section type when using set() with only two arguments is a very confusing behaviour. section() can be used without a value table for the same result. Deleting the option instead will make set() and get() symmetric and will allow to simplify some code that needed to check for nil to call set() or delete() before.
This commit is contained in:
parent
c9fa162ebb
commit
8b65619f59
|
@ -31,7 +31,7 @@ function Cursor:set(config, section, option, value)
|
|||
|
||||
return uciset(self, config, section, option, value)
|
||||
else
|
||||
return uciset(self, config, section, option)
|
||||
return self:delete(config, section, option)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -68,7 +68,7 @@ end
|
|||
function Cursor:section(config, type, name, values)
|
||||
local stat = true
|
||||
if name then
|
||||
stat = self:set(config, name, type)
|
||||
stat = uciset(self, config, name, type)
|
||||
else
|
||||
name = self:add(config, type)
|
||||
stat = name and true
|
||||
|
|
Loading…
Reference in New Issue