Add awful.util.round
This commit is contained in:
parent
178f479d15
commit
977bd9a60e
|
@ -27,6 +27,7 @@ local capi =
|
||||||
awesome = awesome,
|
awesome = awesome,
|
||||||
mouse = mouse
|
mouse = mouse
|
||||||
}
|
}
|
||||||
|
local floor = math.floor
|
||||||
|
|
||||||
local util = {}
|
local util = {}
|
||||||
util.table = {}
|
util.table = {}
|
||||||
|
@ -526,6 +527,13 @@ function util.query_to_pattern(q)
|
||||||
return s
|
return s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Round a number to an integer.
|
||||||
|
-- @tparam number x
|
||||||
|
-- @treturn integer
|
||||||
|
function util.round(x)
|
||||||
|
return floor(x + 0.5)
|
||||||
|
end
|
||||||
|
|
||||||
return util
|
return util
|
||||||
|
|
||||||
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
||||||
|
|
Loading…
Reference in New Issue