remove extra frames from on_deprecated_call traceback
This commit is contained in:
parent
c5c9ef379e
commit
5c005b4f9a
@ -228,9 +228,9 @@ function file.readlines(path)
|
|||||||
return lines
|
return lines
|
||||||
end
|
end
|
||||||
|
|
||||||
function debug.get_traceback()
|
function debug.get_traceback(start)
|
||||||
local frames = {}
|
local frames = {}
|
||||||
local n = 2
|
local n = 2 + (start or 0)
|
||||||
while true do
|
while true do
|
||||||
local info = debug.getinfo(n)
|
local info = debug.getinfo(n)
|
||||||
if info then
|
if info then
|
||||||
@ -243,7 +243,7 @@ function debug.get_traceback()
|
|||||||
end
|
end
|
||||||
|
|
||||||
package = {
|
package = {
|
||||||
loaded={}
|
loaded = {}
|
||||||
}
|
}
|
||||||
local __cached_scripts = {}
|
local __cached_scripts = {}
|
||||||
local __warnings_hidden = {}
|
local __warnings_hidden = {}
|
||||||
@ -253,7 +253,7 @@ function on_deprecated_call(name, alternatives)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
__warnings_hidden[name] = true
|
__warnings_hidden[name] = true
|
||||||
events.emit("core:warning", "deprecated call", name, debug.get_traceback())
|
events.emit("core:warning", "deprecated call", name, debug.get_traceback(2))
|
||||||
if alternatives then
|
if alternatives then
|
||||||
debug.warning("deprecated function called ("..name.."), use "..
|
debug.warning("deprecated function called ("..name.."), use "..
|
||||||
alternatives.." instead\n"..debug.traceback())
|
alternatives.." instead\n"..debug.traceback())
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user