Thread Tools Display Modes
Prev Previous Post   Next Post Next
03-24-24, 04:13 AM   #7
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,246
Originally Posted by SDPhantom View Post
This is how I would implement a fallback list using multiple ors.
Lua Code:
  1. watchedFactionID = watchedFactionID
  2.     or (inInstance and hasDungeonTabard and tabardID)
  3.     or (lookUpSubZones and (citySubZonesAndFactions[subZone] or subZonesAndFactions[subZone]))
  4.     or (inInstance and instancesAndFactions[whichInstanceID])
  5.     or (not lookUpSubZones and isWoDZone and bodyguardRepID)
  6.     or (not inInstance and zonesAndFactions[uiMapID])
  7.     or self.fallbackRepID

Note parenthesis are highly suggested to direct which order you want logic operations to run as mixing and/or operations can lead to unpredictable results.
This solution worked! I tested in Un'Goro Crater, which has no rep assigned and the addon watched my fallback. Then I went into the Stockades dungeon with the Ironforge faction tabard, which worked. And finally, I flew back and forth between the main section of Valdrakken and the Artisan's section and that worked.

Thank you so much!
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » I do not understand why I am getting type Boolean when I should be getting number


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off