Thread Tools Display Modes
08-27-14, 08:47 PM   #1
sirann
A Flamescale Wyrmkin
Join Date: Mar 2007
Posts: 142
Whisper Contents of Table

My code can be found here: http://pastebin.com/sBfiVQY2

the main issue I'm trying to fix is
Lua Code:
  1. SendChatMessage('The Stormlash order is: ' .. for k, v in pairs(Shamans) do print(v) end .. '.  You will get a 10s warning whisper, followed by a "Drop it now!" whisper when you are to drop Stormlash.', 'WHISPER', nil, Shamans[i])

I know the k,v print thing isn't going to work, I was just using that as an illustration for what I would like to do.

Any help would be appreciated.
  Reply With Quote
08-27-14, 08:55 PM   #2
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
table.concat(Shamans, ', ') will return a string with the values separated by commas.

You can replace your for loop with that.

Last edited by semlar : 08-27-14 at 08:57 PM.
  Reply With Quote
08-27-14, 08:57 PM   #3
sirann
A Flamescale Wyrmkin
Join Date: Mar 2007
Posts: 142
Originally Posted by semlar View Post
table.concat(Shamans, ', ') will return a string with the values separated by commas.
You have done me a service I am not worthy of. Thank you.
  Reply With Quote
08-27-14, 09:13 PM   #4
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
If you want to do something more complicated with the data, you can construct the string manually by iterating over the list and adding the values to the end.

This allows you to treat names differently if you want, like emphasizing the name of the person you're whispering.
Lua Code:
  1. local order = Shamans[1] -- Make a string out of the first name
  2. for i = 2, #Shamans do -- Append each name to the existing string
  3.     order = order .. ', ' .. Shamans[i]
  4. end
  5. SendChatMessage('The Stormlash order is: ' .. order .. '.  You will get a 10s warning whisper, followed by a "Drop it now!" whisper when you are to drop Stormlash.', 'WHISPER', nil, Shamans[i])

Also, you're iterating over the Shamans table to whisper warriors about skull banners in the UNIT_DESTROYED section of your addon.

Last edited by semlar : 08-27-14 at 09:20 PM.
  Reply With Quote
08-27-14, 09:43 PM   #5
sirann
A Flamescale Wyrmkin
Join Date: Mar 2007
Posts: 142
Originally Posted by semlar View Post
Also, you're iterating over the Shamans table to whisper warriors about skull banners in the UNIT_DESTROYED section of your addon.
The downside of c/p code
  Reply With Quote
08-27-14, 09:50 PM   #6
sirann
A Flamescale Wyrmkin
Join Date: Mar 2007
Posts: 142
Additionally, I had to add:

Lua Code:
  1. RCC:RegisterEvent('COMBAT_LOG_EVENT_UNFILTERED')

to
Lua Code:
  1. elseif ((event == 'GROUP_ROSTER_UPDATE' or event == 'PLAYER_ENTERING_WORLD') and GetNumGroupMembers() > 0) then
in case you caught that too and removed it from the initial register event section.

Last edited by sirann : 08-27-14 at 09:56 PM.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Whisper Contents of Table


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