summaryrefslogtreecommitdiffhomepage
path: root/modules/admin-mini/luasrc/model/cbi/mini/dhcp.lua
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2009-07-19 00:24:58 +0000
committerJo-Philipp Wich <jow@openwrt.org>2009-07-19 00:24:58 +0000
commit8fcd841aa9af96c8a4a4d3c1a555d2d1ed42332c (patch)
treecf6466b373236442e63742cb4f73b22579940784 /modules/admin-mini/luasrc/model/cbi/mini/dhcp.lua
parent6abba6163290b58cd9ebae98d8459ac38ef52a4b (diff)
convert luci.fs users to nixio.fs api
Diffstat (limited to 'modules/admin-mini/luasrc/model/cbi/mini/dhcp.lua')
-rw-r--r--modules/admin-mini/luasrc/model/cbi/mini/dhcp.lua32
1 files changed, 17 insertions, 15 deletions
diff --git a/modules/admin-mini/luasrc/model/cbi/mini/dhcp.lua b/modules/admin-mini/luasrc/model/cbi/mini/dhcp.lua
index 2aadded3ee..5817a93d77 100644
--- a/modules/admin-mini/luasrc/model/cbi/mini/dhcp.lua
+++ b/modules/admin-mini/luasrc/model/cbi/mini/dhcp.lua
@@ -12,9 +12,11 @@ You may obtain a copy of the License at
$Id$
]]--
-require("luci.model.uci")
-require("luci.sys")
-require("luci.tools.webadmin")
+
+local uci = require "luci.model.uci".cursor()
+local sys = require "luci.sys"
+local wa = require "luci.tools.webadmin"
+local fs = require "nixio.fs"
m = Map("dhcp", "DHCP")
@@ -61,12 +63,12 @@ time.rmempty = true
m2 = Map("luci_ethers", translate("dhcp_leases"))
local leasefn, leasefp, leases
-luci.model.uci.cursor():foreach("dhcp", "dnsmasq",
+uci:foreach("dhcp", "dnsmasq",
function(section)
leasefn = section.leasefile
end
)
-local leasefp = leasefn and luci.fs.access(leasefn) and io.lines(leasefn)
+local leasefp = leasefn and fs.access(leasefn) and io.lines(leasefn)
if leasefp then
leases = {}
for lease in leasefp do
@@ -83,9 +85,7 @@ if leases then
ltime = v:option(DummyValue, 1, translate("dhcp_timeremain"))
function ltime.cfgvalue(self, ...)
local value = DummyValue.cfgvalue(self, ...)
- return luci.tools.webadmin.date_format(
- os.difftime(tonumber(value), os.time())
- )
+ return wa.date_format(os.difftime(tonumber(value), os.time()))
end
end
@@ -96,10 +96,12 @@ s.template = "cbi/tblsection"
mac = s:option(Value, "macaddr", translate("macaddress"))
ip = s:option(Value, "ipaddr", translate("ipaddress"))
-for i, dataset in ipairs(luci.sys.net.arptable()) do
- ip:value(dataset["IP address"])
- mac:value(dataset["HW address"],
- dataset["HW address"] .. " (" .. dataset["IP address"] .. ")")
-end
-
-return m, m2 \ No newline at end of file
+sys.net.arptable(function(entry)
+ ip:value(entry["IP address"])
+ mac:value(
+ entry["HW address"],
+ entry["HW address"] .. " (" .. entry["IP address"] .. ")"
+ )
+end)
+
+return m, m2