local P={}function P.debugcalls()if not _G.__debugCalls then print("\083\116\097\114\116\105\110\103 \068\101\098\117\103\067\097\108\108\115")_G.__debugCalls=true debug.sethook(function()local P=debug.getinfo(2)local E=tostring(P.short_src)local C=tostring(P.name)if C~="\095\095\105\110\100\101\120"then print("\067\097\108\108\058 "..(E..(" -- "..(C..(" -- "..P.currentline)))))end end,"\099")else print("\083\116\111\112\112\101\100 \068\101\098\117\103\067\097\108\108\115")_G.__debugCalls=false debug.sethook(nil,"\099")end end return P
--- Debugging helpers.
-- @module invokation.lang.debug

local M = {}

--- Toggles function call debugging.
-- selene: allow(global_usage)
function M.debugcalls()
  if not _G.__debugCalls then
    print("Starting DebugCalls")
    _G.__debugCalls = true

    debug.sethook(function()
      local info = debug.getinfo(2)
      local src = tostring(info.short_src)
      local name = tostring(info.name)
      if name ~= "__index" then
        print("Call: " .. src .. " -- " .. name .. " -- " .. info.currentline)
      end
    end, "c")
  else
    print("Stopped DebugCalls")
    _G.__debugCalls = false
    debug.sethook(nil, "c")
  end
end

return M
