Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2020
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. local memoryTable = {}
  2.  
  3. local function updateMemoryTable()
  4. local numAddons = GetNumAddOns()
  5. for i = 1, numAddons do
  6. memoryTable[i] = {i, select(2, GetAddOnInfo(i)), 0}
  7. end
  8. end
  9.  
  10. local function sortMemory(a, b)
  11. if a and b then
  12. return a[3] > b[3]
  13. end
  14. end
  15.  
  16. local function updateMemory()
  17. UpdateAddOnMemoryUsage()
  18.  
  19. local total = 0
  20. for i = 1, #memoryTable do
  21. local value = memoryTable[i]
  22. value[3] = GetAddOnMemoryUsage(value[1])
  23. total = total + value[3]
  24. end
  25. table.sort(memoryTable, sortMemory)
  26.  
  27. return total
  28. end
  29.  
  30. updateMemoryTable();
  31. print(updateMemory());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement