diff --git a/lib/awful/client.lua.in b/lib/awful/client.lua.in index 7ad33e6a..5e236247 100644 --- a/lib/awful/client.lua.in +++ b/lib/awful/client.lua.in @@ -874,25 +874,27 @@ end --- -- Returns an iterator to cycle through, starting from the client in focus or -- the given index, all clients that match a given criteria. +-- -- @param filter a function that returns true to indicate a positive match -- @param start what index to start iterating from. Defaults to using the -- index of the currently focused client. -- @param s which screen to use. nil means all screens. +-- -- @usage e.g.: un-minimize all urxvt instances --

-- local urxvt = function (c)
--- return awful.rules.match(c, {class = "URxvt"})
+-- return awful.rules.match(c, {class = "URxvt"})
-- end
--
--- for c in awful.client.cycle(urxvt) do
--- c.minimized = false
+-- for c in awful.client.iterate(urxvt) do
+-- c.minimized = false
-- end
--

-function cycle(filter, start, s) +function iterate(filter, start, s) local clients = capi.client.get(s) local focused = capi.client.focus local start = start or util.table.hasitem(clients, focused) - return util.table.cycle(clients, filter, start) + return util.table.iterate(clients, filter, start) end -- Register standards signals diff --git a/lib/awful/util.lua.in b/lib/awful/util.lua.in index 026e7d87..2c6622ce 100644 --- a/lib/awful/util.lua.in +++ b/lib/awful/util.lua.in @@ -370,11 +370,12 @@ end --- -- Returns an iterator to cycle through, starting from the first element or the -- given index, all elments of a table that match a given criteria. +-- -- @param t the table to iterate -- @param filter a function that returns true to indicate a positive match -- @param start what index to start iterating from. Default is 1 (=> start of -- the table) -function table.cycle(t, filter, start) +function table.iterate(t, filter, start) local count = 0 local index = start or 1 local length = #t