Forums » Bugs

GetInventoryItemInfo

Oct 26, 2010 diqrtvpe link
Very low priority, but GetInventoryItemInfo(itemid) currently returns the same thing as GetInventoryItemIcon(itemid), i.e., the path to the item's icon. I don't know how long it's been this way, but it doesn't return the item info table.
Oct 26, 2010 mr_spuck link
I think that function has multiple return values of which the icon is the first.
Oct 28, 2010 diqrtvpe link
I tried it out with both console_print() and printtable(), and that is the only thing it returned. If it's hiding multiple return values beyond that, I don't know how.
Nov 03, 2010 mr_spuck link
try something like
local icon,name = GetInventoryItemInfo(itemid)
print(name)

or plop all values into a table
printtable({GetInventoryItemInfo(itemid)})

print(({GetInventoryItemInfo(itemid)})[2])
Nov 03, 2010 raybondo link
Spuck is correct. The GetInventoryItemInfo() function essentially returns everything that the GetInventoryItem*() functions return as multiple return values.

The easiest thing to do to see them all is:
printtable{GetInventoryItemInfo(item)}

which is syntactic sugar to:
printtable({GetInventoryItemInfo(item)})
Nov 03, 2010 slime73 link
console_print(GetInventoryItemInfo(item)) works too. <.<
Nov 03, 2010 diqrtvpe link
Ah, I was unaware of that expansion possibility. Thanks for letting me know. I grow less noobish in lua every day, only to remain eternally an utter noob.