Add a deprecated_in variable to util.deprecate args table (#1586)
This commit is contained in:
parent
2f34e69cab
commit
edd9415df6
|
@ -40,8 +40,16 @@ local displayed_deprecations = {}
|
||||||
-- @param[opt] see The message to a new method / function to use.
|
-- @param[opt] see The message to a new method / function to use.
|
||||||
-- @tparam table args Extra arguments
|
-- @tparam table args Extra arguments
|
||||||
-- @tparam boolean args.raw Print the message as-is without the automatic context
|
-- @tparam boolean args.raw Print the message as-is without the automatic context
|
||||||
|
-- @tparam integer args.deprecated_in Print the message only when Awesome's
|
||||||
|
-- version is equal to or greater than deprecated_in.
|
||||||
function util.deprecate(see, args)
|
function util.deprecate(see, args)
|
||||||
args = args or {}
|
args = args or {}
|
||||||
|
if args.deprecated_in then
|
||||||
|
local dep_ver = "v" .. tostring(args.deprecated_in)
|
||||||
|
if awesome.version < dep_ver then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
local tb = debug.traceback()
|
local tb = debug.traceback()
|
||||||
if displayed_deprecations[tb] then
|
if displayed_deprecations[tb] then
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue