* Fixed ffluci.util.trim, ffluci.util.split
This commit is contained in:
parent
187bbe4bbe
commit
b15171305b
3 changed files with 12 additions and 5 deletions
|
@ -153,6 +153,10 @@ function split(str, pat, max, regex)
|
||||||
local t = {}
|
local t = {}
|
||||||
local c = 1
|
local c = 1
|
||||||
|
|
||||||
|
if #str == 0 then
|
||||||
|
return {""}
|
||||||
|
end
|
||||||
|
|
||||||
if #pat == 0 then
|
if #pat == 0 then
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
@ -172,8 +176,9 @@ function split(str, pat, max, regex)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Removes whitespace from beginning and end of a string
|
-- Removes whitespace from beginning and end of a string
|
||||||
function trim (string)
|
function trim(string)
|
||||||
return string:gsub("^%s*(.-)%s*$", "%1")
|
local s = string:gsub("^%s*(.-)%s*$", "%1")
|
||||||
|
return s
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Updates given table with new values
|
-- Updates given table with new values
|
||||||
|
|
|
@ -10,7 +10,6 @@ function action_index()
|
||||||
data.routes = {}
|
data.routes = {}
|
||||||
for i, r in pairs(ffluci.sys.net.routes()) do
|
for i, r in pairs(ffluci.sys.net.routes()) do
|
||||||
if r.Destination == "00000000" then
|
if r.Destination == "00000000" then
|
||||||
r.Gateway = ffluci.sys.net.hexip4(r.Gateway)
|
|
||||||
table.insert(data.routes, r)
|
table.insert(data.routes, r)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -63,9 +63,12 @@
|
||||||
<th><%:metric Metrik%></th>
|
<th><%:metric Metrik%></th>
|
||||||
<th><%:iface Schnittstelle%></th>
|
<th><%:iface Schnittstelle%></th>
|
||||||
</tr>
|
</tr>
|
||||||
<% for i, rt in pairs(routes) do%>
|
<%
|
||||||
|
local be = (routes[1] and routes[1].Mask:sub(-2) == "00")
|
||||||
|
for i, rt in pairs(routes) do
|
||||||
|
%>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%=rt.Gateway%></th>
|
<td><%=ffluci.sys.net.hexip4(rt.Gateway, be)%></th>
|
||||||
<td><%=rt.Metric%></th>
|
<td><%=rt.Metric%></th>
|
||||||
<td><%=rt.Iface%></th>
|
<td><%=rt.Iface%></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
Loading…
Reference in a new issue