diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2012-02-19 17:05:09 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2012-02-19 17:05:09 +0000 |
commit | bbc2c69965517c66b04d068cc9e8dab2c396efa4 (patch) | |
tree | 55b2c798c8f4358872af1871c8bf8145ed01163a /applications/luci-statistics/luasrc | |
parent | ad7aecad88399b917b6a96952f3645c475e73c59 (diff) |
applications/luci-statistics: avoid global vars, avoid nil indexing, get rid of counter variable
Diffstat (limited to 'applications/luci-statistics/luasrc')
-rw-r--r-- | applications/luci-statistics/luasrc/statistics/datatree.lua | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/applications/luci-statistics/luasrc/statistics/datatree.lua b/applications/luci-statistics/luasrc/statistics/datatree.lua index d6de6fa21..850b83a99 100644 --- a/applications/luci-statistics/luasrc/statistics/datatree.lua +++ b/applications/luci-statistics/luasrc/statistics/datatree.lua @@ -196,10 +196,12 @@ end function Instance.host_instances( self ) local hosts_path = fs.glob(self._rrddir..'/*') local hosts = { } - k = 1 - for v in hosts_path do - hosts[k] = fs.basename(v) - k=k+1 + + if hosts_path then + local path + for path in hosts_path do + hosts[#hosts+1] = fs.basename(path) + end end return hosts |