From 885e54007fdaaaa8d4972e904685c6a0ff609e50 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sun, 7 Sep 2008 02:55:42 +0000 Subject: [PATCH] * luci/libs/uvl: implement default value option for variable sections --- libs/uvl/luasrc/uvl.lua | 2 +- libs/uvl/root/lib/uci/schema/meta/schema | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/libs/uvl/luasrc/uvl.lua b/libs/uvl/luasrc/uvl.lua index f40063c7b..089789a5a 100644 --- a/libs/uvl/luasrc/uvl.lua +++ b/libs/uvl/luasrc/uvl.lua @@ -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 diff --git a/libs/uvl/root/lib/uci/schema/meta/schema b/libs/uvl/root/lib/uci/schema/meta/schema index dd373f8ae..7f6981a02 100644 --- a/libs/uvl/root/lib/uci/schema/meta/schema +++ b/libs/uvl/root/lib/uci/schema/meta/schema @@ -267,6 +267,15 @@ config variable option datatype 'string' option required false +# Variable default value (schema.@variable.default) +config variable + option name 'default' + option title 'Datatype of this variable' + option section 'schema.variable' + option type 'variable' + option datatype 'string' + option required false + # Variable validators (schema.@variable.validator) config variable option name 'validator' -- 2.11.0