+ Reply to Thread
Results 1 to 5 of 5

Thread: Shed some light regarding event functions?

  1. #1
    Telaran
    Join Date
    Jun 2011
    Posts
    82

    Default Shed some light regarding event functions?

    Ok so lets say i want to monitor currency changes.

    local functiontoRun(currencies)
    -- do something here
    end

    table.insert(Event.Currency, { functiontoRun, addon.aid, "Currency changed" })

    -------------------------------------

    OK, now before I go any further, i'm not very experienced in programming or lua in general. Everything I know i self taught. With that said I used to do some small addons in WOW. If i did something with events in wow...

    local functiontoRun(self, event, currencies)

    i could use the event function like above instead (using different vars in the function, instead of ONLY currencies... Keeping the post short im skipping some things) ---- Is this at all possible in rifts api and if so how? Again if this is something silly or stupid im missing sorry, im noob at this stuff still.....

    EDIT: Just noticed double post if a mod could delete one of these please. Not sure what happeend there, definitly didnt do the impaitent double click post...
    Last edited by 0dine; 09-23-2012 at 02:25 PM.

  2. #2
    Telaran
    Join Date
    Jun 2011
    Posts
    82

    Default

    nvm possible solution i thought of may not do what i need it to.....
    Last edited by 0dine; 09-23-2012 at 02:38 PM.

  3. #3
    Telaran
    Join Date
    Jun 2011
    Posts
    82

    Default

    I guess what Im trying to figure out how to do. Is it possible for events to have a callback? As in.... I need to pass a specific table to certain events so i can reference it along with what might be passed from an event (ie: even.currency will pass the currency table)

  4. #4
    Sword of Telara DoomSprout's Avatar
    Join Date
    Apr 2011
    Posts
    876

    Default

    Quote Originally Posted by 0dine View Post
    I guess what Im trying to figure out how to do. Is it possible for events to have a callback? As in.... I need to pass a specific table to certain events so i can reference it along with what might be passed from an event (ie: even.currency will pass the currency table)
    You can do that with a Lua closure...

    Code:
    local myTable = {}
    
    table.insert(Event.Currency, 
        { 
            function(currencies) 
                functionToRun(myTable, currencies) 
            end, 
            addon.aid, 
            "Currency changed" 
        })
    Last edited by DoomSprout; 09-25-2012 at 06:57 AM.

    Gadgets: Unit Frames and Other Stuff for RIFT

  5. #5
    Telaran
    Join Date
    Jun 2011
    Posts
    82

    Default

    wow talk about overthinking what i needed to do. thanks a mil!

+ 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