summaryrefslogtreecommitdiffhomepage
path: root/libs/uvl/luasrc
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2008-09-07 03:29:54 +0000
committerJo-Philipp Wich <jow@openwrt.org>2008-09-07 03:29:54 +0000
commit071f485a69adca2804456655845d7fd7945fe24b (patch)
tree32af068c160cc563026763c0027593283878c6f0 /libs/uvl/luasrc
parent96e7e81d1def21256c79a27a86786121ababb37a (diff)
* luci/libs/uvl: prepare support for @type[n] notation in luci.uvl.uvlitem.cid()
Diffstat (limited to 'libs/uvl/luasrc')
-rw-r--r--libs/uvl/luasrc/uvl.lua12
1 files changed, 11 insertions, 1 deletions
diff --git a/libs/uvl/luasrc/uvl.lua b/libs/uvl/luasrc/uvl.lua
index 089789a5a..98e7dfba6 100644
--- a/libs/uvl/luasrc/uvl.lua
+++ b/libs/uvl/luasrc/uvl.lua
@@ -813,7 +813,17 @@ end
uvlitem = luci.util.class()
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
function uvlitem.sid(self)