Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
awall
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
7
Issues
7
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alpine
awall
Commits
16e25b4f
Commit
16e25b4f
authored
Feb 16, 2012
by
Kaarle Ritvanen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
util.extend helper function
parent
7a202674
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
10 deletions
+10
-10
awall/model.lua
awall/model.lua
+3
-9
awall/util.lua
awall/util.lua
+7
-1
No files found.
awall/model.lua
View file @
16e25b4f
...
...
@@ -150,9 +150,7 @@ function Rule:zoneoptfrags()
for
i
=
1
,
math.max
(
1
,
table
.
maxn
(
self
.
out
))
do
ozone
=
self
.
out
[
i
]
if
izone
~=
ozone
or
not
izone
then
for
i
,
ofrags
in
ipairs
(
zonepair
(
izone
,
ozone
))
do
table.insert
(
res
,
ofrags
)
end
util
.
extend
(
res
,
zonepair
(
izone
,
ozone
))
end
end
end
...
...
@@ -183,9 +181,7 @@ function Rule:servoptfrags()
if
new
or
ports
[
sdef
.
proto
][
1
]
then
if
sdef
.
port
then
for
i
,
port
in
util
.
listpairs
(
sdef
.
port
)
do
table.insert
(
ports
[
sdef
.
proto
],
port
)
end
util
.
extend
(
ports
[
sdef
.
proto
],
sdef
.
port
)
else
ports
[
sdef
.
proto
]
=
{}
end
end
...
...
@@ -329,9 +325,7 @@ function Rule:trules()
end
end
for
i
,
ofrag
in
ipairs
(
ffilter
(
self
:
extraoptfrags
()))
do
table.insert
(
res
,
ofrag
)
end
util
.
extend
(
res
,
ffilter
(
self
:
extraoptfrags
()))
tag
(
res
,
'table'
,
self
:
table
(),
false
)
...
...
awall/util.lua
View file @
16e25b4f
...
...
@@ -9,7 +9,9 @@ module(..., package.seeall)
local
function
list
(
var
)
if
not
var
then
return
{}
end
return
type
(
var
)
==
'table'
and
var
[
1
]
and
var
or
{
var
}
if
type
(
var
)
~=
'table'
then
return
{
var
}
end
if
not
next
(
var
)
then
return
{}
end
return
var
[
1
]
and
var
or
{
var
}
end
function
listpairs
(
var
)
...
...
@@ -31,3 +33,7 @@ function contains(tbl, value)
for
k
,
v
in
pairs
(
tbl
)
do
if
v
==
value
then
return
true
end
end
return
false
end
function
extend
(
tbl1
,
tbl2
)
for
i
,
var
in
listpairs
(
tbl2
)
do
table.insert
(
tbl1
,
var
)
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment