Concatenate parameters and string - WoWInterface
Thread Tools Display Modes
08-11-22, 02:18 PM   #1
A Cliff Giant
Benalish's Avatar
Join Date: Dec 2012
Posts: 72
Concatenate parameters and string

Hello there. This code should report who cast the buff, which buff cast, and who received it

Lua Code:
  1. local f = CreateFrame("Frame")
  3. f:SetScript("OnEvent", function(self, event, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10,
  4.                                               arg11, arg12, arg13)
  5.     if (event == "COMBAT_LOG_EVENT_UNFILTERED") then
  6.         if (arg2 == "SPELL_AURA_APPLIED") then --do stuffs
  7.                 end
  8.     end
  9. end)

What exactly do I have to write in order to get a sentence in the form "arg4 cast arg10 on arg7"?
  Reply With Quote
08-11-22, 02:45 PM   #2
I did that?
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,537
Depends but the simplest just see it in your chat frame would be:

Lua Code:
  1. if (arg2 == "SPELL_AURA_APPLIED") then --do stuffs
  2.         print(arg4, "cast", arg10, "on", arg7)
  3. end

You could use concatination:
or string format (%s is replaced with strings, see this for other replacment values:
local msg = "%s cast %s on %s"
print(string.format(msg, arg4, arg10, arg7))
or ...

The last two are useful if you are using something other than print() (like sending to the chat system)
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 08-11-22 at 02:56 PM.
  Reply With Quote
08-11-22, 09:26 PM   #3
A Pyroguard Emberseer
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,136
Also since BfA, CLEU doesn't send its payload to the event handler anymore. You need to use CombatLogGetCurrentEventInfo() to query the args now.
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Concatenate parameters and string

Thread Tools
Display Modes

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