diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2013-12-16 15:17:26 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2013-12-16 15:17:26 +0000 |
commit | d376ea935cb537811b60d64d034a54da021fd6f2 (patch) | |
tree | e182ab7557f8f706cc34f15c3ffdc92df3bfc51a | |
parent | fd1cfa9c6e09c316dce0bbb338bd32e9b1023d84 (diff) | |
download | lua-aports-d376ea935cb537811b60d64d034a54da021fd6f2.tar.bz2 lua-aports-d376ea935cb537811b60d64d034a54da021fd6f2.tar.xz |
aports.lua: replace foreach_remote_source API with iterator
-rwxr-xr-x | aports.lua | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -135,17 +135,18 @@ function M.is_remote(url) return false end --- iterate over all entries in source and execute the function for remote -function M.foreach_remote_source(p, func) - local _,s +-- iterator for all remote sources of given pkg/aport +function M.remote_sources(p) if p == nil or type(p.source) ~= "table" then - return + return nil end - for _,url in pairs(p.source) do - if M.is_remote(url) then - func(url) + return coroutine.wrap(function() + for _,url in pairs(p.source) do + if M.is_remote(url) then + coroutine.yield(url) + end end - end + end) end function M.get_maintainer(pkg) |