if-then-else switch
I am starting to develop my own addon. At the moment, I am working through code to determine a player's role in a group based on spec/stance/etc.
One "if" statement I am using feels like it could be much better: Code:
local _, class = UnitClass("player") |
Well not really, you could always do something like this but it is not necessarily faster :
Code:
local _, class = UnitClass("player") |
There is no built in way for this, but you can make them yourself like this:
Code:
local function multeq(check, ...) |
Thanks for the replies. I think I'm going to have to keep the code I have, mostly for clarity.
The purpose of the code being to determine someone's spec (easy part) and role ("Damage", "Healer", or "Tank") makes for an apparently complex function. I wish at the least that they would include Righteous Fury in with a pally aura so that I can consolidate the tank checks to a class & stance check. /sigh Off to make this function useful. Thanks again! |
Most all tanking specs have key talents that all tanks will take, so scanning that one talent will determine what role that player is fulfilling. I would really recommend you use nightcracker's suggestion though. It may seem complex now, but it's a really good habit to be in. :)
|
Quote:
It is concentrated awesomeness with a spread of bacon... |
All times are GMT -6. The time now is 06:43 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI