Quantcast
WoWInterface - View Single Post - Check if itemString or itemLink
View Single Post
12-30-17, 05:29 PM   #1
Marsgames
An Aku'mai Servant
 
Marsgames's Avatar
Join Date: Jul 2016
Posts: 33
Check if itemString or itemLink

Hey, I would like to know if there’s a way to check if I have an itemLink or an itemString.

I’m using
Lua Code:
  1. GetInventoryItemLink("player", GetInventorySlotInfo("HeadSlot"))
to get all my equipped items, but because of the item is not always cached, sometimes I get something like this : "[Tome de la raison déclinante]" that is an itemLink, but sometimes I only get "[]". At first I thought it was nothing but after some research, I found that it was an itemString, and if I try to parse it with
Lua Code:
  1. local aze = GetInventoryItemLink("player",GetInventorySlotInfo("Trinket0Slot"))
  2. local itemString = select(3, strfind(aze, "|H(.+)|h"))
  3. print(itemString)
It returns "item:147019::::::::110:265::3:3:3561:1492:3528:::[]"

So, as I want to have an itemLink, is there a way to check if it returns an itemLink or an itemString, like that I can wait for ITEM_INFO_RECEIVED to add the itemLink in my table.
  Reply With Quote