1. Hey

    I am new to programming lua and wow and i am just fooling around a bit.

    I have made a .lua file with;

     MyEventFrame = CreateFrame("Frame", "MyEventFrame", UIParent)
     MyEventFrame:RegisterEvent("ITEM_PUSH")
     MyEventFrame:RegisterEvent("AUCTION_OWNED_LIST_UPDATE")
    
     function MyEventFrame_OnEvent(self, event, ...)
       if event == "ITEM_PUSH" then
         local pushedItem = ...
         if not pushedItem then
           print("Nothing i variable")
         else
           print("Has something")
         end
       end
       if event == "AUCTION_OWNED_LIST_UPDATE" then
         local auctionItem = ...
         print("Auction made")
       end
     end
    
     MyEventFrame:SetScript("OnEvent", MyEventFrame_OnEvent)
    

    Just to see what happens when an event is fired. The '...' gives me a bit of worries - what does it contains and can I get some info from it?

    In the ITEM_PUSH event I would like to get the itemID on the item that has been pushed - and also item informations in the AUCTION_OWNED_LIST_UPDATE event - like what price the auction was sat to.

    Can someone help a novice?

    Kind regards

    Johnny E. Jensen

  2. hiho

    the "..." is a list of arguments returned by the event

    i would try something like

     MyEventFrame = CreateFrame("Frame", "MyEventFrame", UIParent)
     MyEventFrame:RegisterEvent("ITEM_PUSH") 
     MyEventFrame:RegisterEvent("AUCTION_OWNED_LIST_UPDATE")
    
     function MyEventFrameOnEvent(self, event, ...)
        if ( event == "ITEM_PUSH" ) then
            local pushedItem = ...
            if not pushedItem then
                print("Nothing in variable")
            else
                print(...)
            end
        end
    
        if ( event == "AUCTION_OWNED_LIST_UPDATE" ) then
            print(...)
        end
     end
    
     MyEventFrame:SetScript("OnEvent", MyEventFrame_OnEvent)
    

    if I'm right this would print out every argument of an event

    also the event names have to be correct

    you can find a list of all events and their arguments here

    http://wowprogramming.com/docs/events

    Xers

  3. Variable function arguments, that is functions that may take any number of arguments, are covered in [Chapter 5][http://wowprogramming.com/chapters/second-edition/05], specifically on page 81. The ... is a special Lua construct that contains all of the arguments to the function, except the arguments that were specifically named prior. The most typical case of this is event handling, where the first argument passed to your handler function is the frame that registered for the event, the second argument is a string containing the name of the event, and ... contains the rest of the arguments.

    Hope that helps, and the book should help clarify if not.

  4. The book is great but too big.

    I need a pocket edition of this book ;D

  5. Tell me about it, I have to keep copies at both home and work to ensure I can answer any questions =)

  6. Hello

    The print(...) only gives the path to the item icon.

    /Johnny

  7. That event definitely USED to include the bag id as well. I'd suggest using /eventtrace to see precisely what arguments are coming with the event, then you'll know where things stand. If it's bagID then icon, you can do:

     local bagId, icon = ...
    

    and get both of those arguments.