Add awful.util.round
This commit is contained in:
parent
178f479d15
commit
977bd9a60e
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue