PDA

View Full Version : Lua conditionals - a better way?


cscam
30-06-2007, 04:17 AM
I've just started fiddling with lua and addons, I've got a couple of ideas up my sleeve but I'm starting by playing with Serenity and changing somethings in it to suit me. My first move was to have it display the Tempest Keep HP and MP pots over traditional pots if I was in one of the instances, it works but its messy:

elseif self.PT:ItemInSet(itemId, 'Consumable.Potion.Recovery.Mana.Tempest Keep') then
if GetRealZoneText() == "The Mechanar" or GetZoneText() == "The Botanica" or GetZoneText() == "The Arcatraz" or GetZoneText() == "The Eye" then
self:InventorySetItem('POTION_MP', itemId, itemCount, false);
end

..etc. I've played with plenty of other scripting languages and eg. in Python I could get that done much easier like this:

elif self.PT:ItemInSet(itemId, 'Consumable.Potion.Recovery.Mana.Tempest Keep'):
if GetRealZoneText() in ["The Mechanar", "The Botanica", "The Arcatraz", "The Eye"]:
self:InventorySetItem('POTION_MP', itemId, itemCount, false);

a) Is there an easier way to do basic conditionals in lua and/or
b) could someone link me to some decent documentation? I tried Google and kept getting weird hits for DDR and nothing remotely useful :(

Thanks

Telic
30-06-2007, 06:40 AM
http://wow.incgamers.com/forums/showthread.php?t=398979