diff --git a/lib/awful/util.lua b/lib/awful/util.lua index ab157171d..3ee1fcb7d 100644 --- a/lib/awful/util.lua +++ b/lib/awful/util.lua @@ -27,6 +27,7 @@ local capi = awesome = awesome, mouse = mouse } +local floor = math.floor local util = {} util.table = {} @@ -526,6 +527,13 @@ function util.query_to_pattern(q) return s end +--- Round a number to an integer. +-- @tparam number x +-- @treturn integer +function util.round(x) + return floor(x + 0.5) +end + return util -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80