Thread Tools Display Modes
02-14-11, 10:34 AM   #1
Kayja
A Deviate Faerie Dragon
Join Date: Jan 2009
Posts: 19
GetAddOnMemoryUsage... confused

Busy just writting up a little addon as replacement to SLDT which I just use to purely show a small strip on my MiniMap like: "x fps x ms x.x mb", so I shoved this little addon together below but for some crazy reason it just won't collect the data from GetAddOnMessageUsage and constantly returns 0 (not nil, just 0 as a number) and it has my head pickled as I can't figure out why... any ideas?

f is the frame, f.txt is the font string. fps and ms work just fine, mem however doesn't.

Code:
local new, mb = 0, 0

f:SetScript("OnUpdate", function(self, old)
	new = new + old
	if ( new >= 3 ) then
		for i = 1, GetNumAddOns() do
			if ( IsAddOnLoaded(i) ) then
				mb = mb + (GetAddOnMemoryUsage(i)/1024)
			end
                end
		
		fps = format("%.0f |cffff0000fps|r", GetFramerate())
		lat = format("%s |cffff0000ms|r", select(3, GetNetStats()))
		mem = format("%.1f |cffff0000mb|r", mb)
		f.txt:SetFormattedText("%s %s %s", fps, lat, mem)

		f:SetWidth(f.txt:GetStringWidth())
		f:SetHeight(f.txt:GetStringHeight())
		
		new, mb = 0, 0
	end
end)
  Reply With Quote
02-14-11, 10:40 AM   #2
Kayja
A Deviate Faerie Dragon
Join Date: Jan 2009
Posts: 19
Nevermind all sorted, forgot to call UpdateAddOnMemoryUsage().
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » GetAddOnMemoryUsage... confused


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off