Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
WoW
Talk
English
Views
Read
Edit
History
More
Search
Navigation
Home
Random page
Help using wiki
Editions
for WoW
for WildStar
for Solar2D
Documentation
for WoW
for WildStar
Reference
WoW
⦁ FrameXML
⦁ AddOns
⦁ API
⦁ WoW Lua
WildStar
⦁ AddOns
⦁ API
⦁ WildStar Lua
Engine
Tools
What links here
Related changes
Special pages
Page information
Site
Recent Changes
Editing
WoW:Handling events
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== The vararg expression === The vararg expression (...) may contain additional arguments supplied by the event. Arguments contained in ... can be read by simply assigning them to other variables, possibly using the [[API_select|select]] function to skip forward to a specific argument in the list. Consider the example of handling [[API_COMBAT_LOG_EVENT|COMBAT_LOG_EVENT]]: function eventHandler(self, event, ...) if event == "COMBAT_LOG_EVENT" then local timestamp, combatEvent, sourceGUID, sourceName, sourceFlags, destGUID, destName, destFlags = ...; -- Those arguments appear for all combat event variants. local eventPrefix, eventSuffix = combatEvent:match("^(.-)_?([^_]*)$"); if eventSuffix == "DAMAGE" then -- Something dealt damage. The last 9 arguments in ... describe how it was dealt. -- To extract those, we can use the select function: local amount, overkill, school, resisted, blocked, absorbed, critical, glancing, crushing = select(select("#", ...)-8, ...); -- select("#", ...) returns number of arguments in the vararg expression -- Do something with the damage details ... if eventPrefix == "RANGE" or eventPrefix:match("^SPELL") then -- The first three arguments after destFlags in ... describe the spell or ability dealing damage. -- Extract this data using select as well: local spellId, spellName, spellSchool = select(9, ...); -- Everything from 9th argument in ... onward -- Do something with the spell details ... end end end end
Summary:
Please note that all contributions to AddOn Studio are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
AddOn Studio Wiki:Copyrights
for details).
Submissions must be written by you, or copied from a public domain or similar free resource (see
AddOn Studio Wiki:Copyrights
for details).
Cancel
Editing help
(opens in new window)