debug: Allow "deprecated_in" for class deprecation.
This commit is contained in:
parent
5ad02d0b8b
commit
da8daa8dfc
|
@ -130,12 +130,23 @@ end
|
|||
|
||||
--- Create a class proxy with deprecation messages.
|
||||
-- This is useful when a class has moved somewhere else.
|
||||
-- @tparam table fallback The new class
|
||||
-- @tparam string old_name The old class name
|
||||
-- @tparam string new_name The new class name
|
||||
-- @tparam table fallback The new class.
|
||||
-- @tparam string old_name The old class name.
|
||||
-- @tparam string new_name The new class name.
|
||||
-- @tparam[opt={}] args The name.
|
||||
-- @tparam[opt] number args.deprecated_in The version which deprecated this
|
||||
-- class.
|
||||
-- @treturn table A proxy class.
|
||||
-- @staticfct gears.debug.deprecate_class
|
||||
function debug.deprecate_class(fallback, old_name, new_name)
|
||||
function debug.deprecate_class(fallback, old_name, new_name, args)
|
||||
args = args or {}
|
||||
if args.deprecated_in then
|
||||
local dep_ver = "v" .. tostring(args.deprecated_in)
|
||||
if awesome.version < dep_ver then
|
||||
return fallback
|
||||
end
|
||||
end
|
||||
|
||||
local message = old_name.." has been renamed to "..new_name
|
||||
|
||||
local function call(_,...)
|
||||
|
|
Loading…
Reference in New Issue