diff options
author | onefang | 2019-12-29 10:16:06 +1000 |
---|---|---|
committer | onefang | 2019-12-29 10:16:06 +1000 |
commit | 393eb13e81d2f0f88acb4b83e132124c3d376401 (patch) | |
tree | 8f7d0ea5989e20fde17b8433f88d0ba2f0251f25 /apt-panopticommon.lua | |
parent | Minor cleanups, no logic changes. (diff) | |
download | apt-panopticon-393eb13e81d2f0f88acb4b83e132124c3d376401.zip apt-panopticon-393eb13e81d2f0f88acb4b83e132124c3d376401.tar.gz apt-panopticon-393eb13e81d2f0f88acb4b83e132124c3d376401.tar.bz2 apt-panopticon-393eb13e81d2f0f88acb4b83e132124c3d376401.tar.xz |
Refactor nested pairs() calls.
Diffstat (limited to 'apt-panopticommon.lua')
-rw-r--r-- | apt-panopticommon.lua | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/apt-panopticommon.lua b/apt-panopticommon.lua index b1f39d7..8a18c4b 100644 --- a/apt-panopticommon.lua +++ b/apt-panopticommon.lua | |||
@@ -334,6 +334,20 @@ dumpTableSub = function (table, space) | |||
334 | return r | 334 | return r |
335 | end | 335 | end |
336 | 336 | ||
337 | |||
338 | APT.allpairs = function(tbl, func) | ||
339 | for k, v in pairs(tbl) do | ||
340 | if 'table' == type(v) then | ||
341 | for i, w in pairs(v) do | ||
342 | func(i, w, k, v) | ||
343 | end | ||
344 | else | ||
345 | func(k, v) | ||
346 | end | ||
347 | end | ||
348 | end | ||
349 | |||
350 | |||
337 | APT.search = function(t, s) | 351 | APT.search = function(t, s) |
338 | for i, v in pairs(t) do | 352 | for i, v in pairs(t) do |
339 | if v == s then return true end | 353 | if v == s then return true end |