WoW addons run in a sandboxed Lua environment and cannot write arbitrary files to disk. However, they can save data to SavedVariables, which get written when you /reload or log out.
.toc file:
## SavedVariables: MyAddonDB, MyAddonDebug
function MyAddon:DumpDebugInfo()
MyAddonDebug = {
timestamp = date("%Y-%m-%d %H:%M:%S"),
-- collect whatever data you need
}
print("Debug info saved. Do /reload to write SavedVariables.")
end
Trigger the dump via slash command, then /reload to flush to disk
WTF/Account/<ACCOUNT>/SavedVariables/MyAddon.lua
function MyAddon:InvestigateFrame(frameName)
local frame = _G[frameName]
if not frame then return end
MyAddonDebug = {
regions = {},
children = {},
}
-- Get regions (textures, fontstrings)
for i, region in ipairs({frame:GetRegions()}) do
table.insert(MyAddonDebug.regions, {
type = region:GetObjectType(),
name = region:GetName() or "unnamed",
shown = region:IsShown(),
})
end
-- Get children (frames)
for i, child in ipairs({frame:GetChildren()}) do
table.insert(MyAddonDebug.children, {
type = child:GetObjectType(),
name = child:GetName() or "unnamed",
shown = child:IsShown(),
})
end
end
If you have BugSack installed, Lua errors are captured in !BugGrabber.lua:
WTF/Account/<ACCOUNT>/SavedVariables/!BugGrabber.lua
After hitting errors, /reload and read this file for full stacktraces.
This workflow enables an external tool (like Claude Code) to: