Page 1 of 1

how to get the type of an item?

Posted: Thu Mar 08, 2012 10:02 pm
by Rickster
there is a function to compare the type of an item to a string, which returns a boolean:

Code: Select all

item:isType("xxx")
is there a way to get the type of an item?

i tried these, which both do not work

Code: Select all

item:getType()
item.Type
is there a place i can find informations like that?

Re: how to get the type of an item?

Posted: Thu Mar 08, 2012 10:57 pm
by lisa
item:isType is a function in micromacro/rom/classes/item.lua

Code: Select all

function CItem:isType(typename)
there is also this

Code: Select all

function CItem:getTypes()
which you would use like this.

Code: Select all

for slot, item in pairs(inventory.BagSlot) do
local itemtype, itemsubtype, itemsubsubtype = item:getTypes()
--some code stuff here to use the info
end