View Single Post
12-14-13, 06:44 AM   #107
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
You don't need to make a whole new function, just check the callback and shift the args as needed:
Code:
function DoSomethingWhenResStarted(callback, targetUnit, targetGUID, casterUnit, casterGUID, endTime)
     local isMass = callback == "LibResInfo_MassResStarted"
     if isMass then
          targetUnit, targetGUID, casterUnit, casterGUID, endTime = nil, nil, targetUnit, targetGUID, casterUnit
     end
     -- do stuff
It would probably make more sense for LRI to change the order of args to better facilitate a single handler function, but that would break backwards compatibility; currently, addons that don't add the new Mass Res callbacks should continue to work as-is.

Edit:
The MassResStarted callback was missing the endTime variable; that's been fixed in r67.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.

Last edited by Phanx : 12-20-13 at 10:05 PM.
  Reply With Quote