+ Reply to Thread
Results 1 to 3 of 3

Thread: Some help understanding Item updates and Inspect

  1. #1
    Soulwalker
    Join Date
    Jul 2014
    Posts
    6

    Default Some help understanding Item updates and Inspect

    I am working on an addon which attaches a function to the Event.Item.Slot & Event.Item.Update events (essentially looking for when a player loots an item). I have the following line:

    Command.Event.Attach(Event.Item.Update, itemLooted, "ItemLooted")

    When the function is called I then want to look at the details of the item with Inspect.Item.Detail(). It is my understanding that you have to specify in the Item.Detail call what the ID of the item instance is. My question is how do I get the Event.Item.Update event to pass the ID for the detected changed item to the itemLooted function?
    Thanx for any help!!

  2. #2
    Plane Touched
    Join Date
    Feb 2012
    Posts
    228

    Default

    According to the documentation, both events pass the updated inventory slots table as an event parameter, so your attached function should look something like this:

    Code:
    function itemLooted(eventHandle, updates)
      for slotID, itemID in pairs(updates) do
        if type(itemID) == "string" and itemID ~= "nil" then
          local itemDetail = Inspect.Item.Detail(itemID)
          -- Do your stuff
        end
      end
    end

  3. #3
    Soulwalker
    Join Date
    Jul 2014
    Posts
    6

    Default

    Thanks. I'll give this a shot.

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts