View Single Post
10-26-18, 12:55 PM   #17
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
To answer the OP's question about cycling in reverse:
Lua Code:
  1. -- cycle all the units in the party, including the player, in reverse order
  2. local function ReverseParty()
  3.     for i = GetNumGroupMembers() + 1, -1 do
  4.         local unit = party..i
  5.         -- if unit is nil, it should be the player, but check anyway
  6.         if unit then
  7.             -- found party member
  8.             print("Found party member number party" .. party..i)
  9.         else
  10.             -- it is not partyN
  11.             print("Found the player")
  12.         end
  13.     end
  14. end

Last edited by myrroddin : 10-26-18 at 01:00 PM. Reason: better logic
  Reply With Quote