Merge pull request #1665 from awesomeWM/swap_find_by_name_args

doc: find_by_name: Fix the doc
This commit is contained in:
Emmanuel Lepage Vallée 2017-03-19 17:21:27 -04:00 committed by GitHub
commit c158a32547
1 changed files with 11 additions and 2 deletions

View File

@ -451,11 +451,20 @@ function tag.gettags(s)
return s and s.tags or {} return s and s.tags or {}
end end
--- Find a tag by name --- Find a tag by name.
-- @tparam[opt] screen s The screen of the tag -- @tparam screen s The screen of the tag
-- @tparam string name The name of the tag -- @tparam string name The name of the tag
-- @return The tag found, or `nil` -- @return The tag found, or `nil`
-- @usage -- For the current screen
-- local t = awful.tag.find_by_name(awful.screen.focused(), "name")
--
-- -- For a screen index
-- local t = awful.tag.find_by_name(screen[1], "name")
--
-- -- For all screens
-- local t = awful.tag.find_by_name(nil, "name")
function tag.find_by_name(s, name) function tag.find_by_name(s, name)
--TODO v5: swap the arguments and make screen [opt]
local tags = s and s.tags or root.tags() local tags = s and s.tags or root.tags()
for _, t in ipairs(tags) do for _, t in ipairs(tags) do
if name == t.name then if name == t.name then