* luci/libs/uvl: implement default value option for variable sections
[oweals/luci.git] / libs / uvl / luasrc / uvl.lua
index aada2e6c231a890f6799be801ff2a54cb5beb3eb..089789a5aaf34509ca0cd6185b3ccb7c970b1395 100644 (file)
@@ -391,7 +391,7 @@ function UVL.read_scheme( self, scheme, alias )
                        return true
                else
                        return false, so:error(ERR.SME_READ(so,bc))
-               end      
+               end
        end
 end
 
@@ -630,7 +630,7 @@ function UVL._read_scheme_parts( self, scheme, schemes )
                                local oo = so:option(r[3])
                                local eo = oo:enum(v.value)
 
-                               if t.type ~= "enum" then
+                               if t.type ~= "enum" and t.type ~= "reference" then
                                        return false, scheme:error(ERR.SME_EBADTYPE(eo))
                                end
 
@@ -1119,7 +1119,7 @@ end
 --- Get the value of this option.
 -- @return     The associated configuration value
 function option.value(self)
-       local v = self:config()
+       local v = self:config() or self:scheme('default')
        if v and self:scheme('multival') then
                v = luci.util.split( v, "%s+", nil, true )
        end