X-Git-Url: https://git.archive.openwrt.org/?a=blobdiff_plain;f=libs%2Fuvl%2Fluasrc%2Fuvl%2Fdependencies.lua;fp=libs%2Fuvl%2Fluasrc%2Fuvl%2Fdependencies.lua;h=fc407a985912a1302db967bb0d414e7497681e74;hb=23101e71374383bdd1bae09166c2581daaa44b22;hp=ced275e6b38d94d364e6051a3b6e70799a8005ae;hpb=606f7dc31317f110a98bbdb64baf00d6064bac2c;p=project%2Fluci.git diff --git a/libs/uvl/luasrc/uvl/dependencies.lua b/libs/uvl/luasrc/uvl/dependencies.lua index ced275e6b..fc407a985 100644 --- a/libs/uvl/luasrc/uvl/dependencies.lua +++ b/libs/uvl/luasrc/uvl/dependencies.lua @@ -19,21 +19,31 @@ module( "luci.uvl.dependencies", package.seeall ) function _parse_reference( r, c, s, o ) local ref = { } local vars = { - config = c, - section = s, - option = o + config = ( c or '$config' ), + section = ( s or '$section' ), + option = ( o or '$option' ) } for i, v in ipairs(luci.util.split(r,".")) do - table.insert( ref, (v:gsub( "%$(.+)", function(n) return vars[n] end )) ) + table.insert(ref, (v:gsub( "%$(.+)", function(n) return vars[n] end ))) end - if #ref == 1 and c and s then - ref = { c, s, ref[1] } - elseif #ref == 2 and c then - ref = { c, unpack(ref) } - elseif #ref ~= 3 then - ref = nil + if c or s then + if #ref == 1 and c and s then + ref = { c, s, ref[1] } + elseif #ref == 2 and c then + ref = { c, unpack(ref) } + elseif #ref ~= 3 then + ref = nil + end + else + if #ref == 1 then + ref = { '$config', '$section', ref[1] } + elseif #ref == 2 then + ref = { '$config', unpack(ref) } + elseif #ref ~= 3 then + ref = nil + end end return ref