* luci/libs/uvl: prepare support for @type[n] notation in luci.uvl.uvlitem.cid()

This commit is contained in:
Jo-Philipp Wich 2008-09-07 03:29:54 +00:00
parent 96e7e81d1d
commit 071f485a69

View file

@ -813,7 +813,17 @@ end
uvlitem = luci.util.class() uvlitem = luci.util.class()
function uvlitem.cid(self) function uvlitem.cid(self)
return table.concat( self.cref, '.' ) if #self.cref == 1 then
return self.cref[1]
else
local r = { unpack(self.cref) }
local c = self.c
if c and c[r[2]] and c[r[2]]['.anonymous'] and c[r[2]]['.index'] then
r[2] = '@' .. c[r[2]]['.type'] ..
'[' .. tostring(c[r[2]]['.index']) .. ']'
end
return table.concat( r, '.' )
end
end end
function uvlitem.sid(self) function uvlitem.sid(self)