Add awful.util.round

This commit is contained in:
Daniel Hahler 2015-08-12 14:09:45 +02:00
parent 178f479d15
commit 977bd9a60e
1 changed files with 8 additions and 0 deletions

View File

@ -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