rename the iterator methods named cycle to iterate, and prettify luadoc a bit
To avoid collision and confusion with other methods having the same name. So, awful.client.cycle -> awful.client.iterate (renamed) awful.util.table.cycle -> awful.util.table.iterate (renamed) These methods were added in commit "add awful.client.cycle", and "add awful.util.table.cycle". Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com> Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
cca672faa8
commit
c623734632
|
@ -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
|
||||
-- <p><code>
|
||||
-- local urxvt = function (c) <br/>
|
||||
-- return awful.rules.match(c, {class = "URxvt"}) <br/>
|
||||
-- end <br/>
|
||||
-- </br>
|
||||
-- for c in awful.client.cycle(urxvt) do <br/>
|
||||
-- for c in awful.client.iterate(urxvt) do <br/>
|
||||
-- c.minimized = false <br/>
|
||||
-- end <br/>
|
||||
-- </code></p>
|
||||
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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue