FreeKill/lua/core/debug.lua
notify 9a951fdbfe
Spdx license (#109)
在所有代码中添加了许可证标记头
2023-04-09 13:35:35 +08:00

23 lines
621 B
Lua

-- SPDX-License-Identifier: GPL-3.0-or-later
---@diagnostic disable: lowercase-global
inspect = require "inspect"
DebugMode = true
function PrintWhenMethodCall()
local info = debug.getinfo(2)
local name = info.name
local line = info.currentline
local namewhat = info.namewhat
local shortsrc = info.short_src
if (namewhat == "method") and
(shortsrc ~= "[C]") and
(not string.find(shortsrc, "/lib")) then
print(shortsrc .. ":" .. line .. ": " .. name)
end
end
--debug.sethook(PrintWhenMethodCall, "c")
function p(v) print(inspect(v)) end
function pt(t) for k,v in pairs(t)do print(k,v) end end