View Single Post
06-13-17, 02:18 AM   #4
lightspark
A Rage Talon Dragon Guard
 
lightspark's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2012
Posts: 341
Originally Posted by loff93 View Post
Awesome, wasn't sure how to write
Code:
local name, _, _, _, _, _, _, _, _, texture = GetItemInfo(itemID)
without storing everything etc. Works really well , but only if the character has already cached the texture.
How do I solve this issue:
When character has already "GET_ITEM_INFO_RECEIVE" the item ID but still needs the texture?
Code:
wait[itemID] = {}
Just call GetItemInfo again:
Lua Code:
  1. cache_writer:SetScript('OnEvent', function(self, event, ...)
  2.     if event == 'GET_ITEM_INFO_RECEIVED' then
  3.         local itemID = ...
  4.         if wait[itemID] then
  5.             local _, _, _, _, _, _, _, _, _, texture = GetItemInfo(itemID)
  6.             print(texture)
  7.  
  8.             wait[itemID] = nil
  9.         end
  10.     end
  11. end)

-- edit #1

But if you need only icon textures, you're better off using GetItemInfoInstant instead. This way you can avoid this cache voodoo.
__________________

Last edited by lightspark : 06-13-17 at 02:22 AM.
  Reply With Quote