X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/cf2c44249973125a51c370311e7361d9c1e84771..f849e631d64e7445ca8abde847191976447f0f93:/helpers.lua diff --git a/helpers.lua b/helpers.lua index 6a47738..8eed10f 100644 --- a/helpers.lua +++ b/helpers.lua @@ -9,7 +9,7 @@ local debug = require("debug") local assert = assert -local capi = { timer = (type(timer) == 'table' and timer or require ("gears.timer")) } +local capi = { timer = require ("gears.timer") } local io = { open = io.open, lines = io.lines, popen = io.popen } @@ -144,6 +144,16 @@ end -- {{{ Misc +-- check if an element exist on a table +function helpers.element_in_table(element, tbl) + for _, i in pairs(tbl) do + if i == element then + return true + end + end + return false +end + -- iterate over table of records sorted by keys function helpers.spairs(t) -- collect the keys