View Single Post
11-02-10, 06:13 PM   #10
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,360
... is a special variable name that holds an indefinite number of parameters.

It's called a vararg (variable arguments)

When you don't know how many params will be passed to a function
(OnEvent is a prime example as different events pass a different number of arguments)
you can use a vararg to catch them all.

To assign the individual arguments to variables you can just do:
local arg1, arg2, arg3, argX = ...
inside the function.
If you want to know the number of arguments in the vararg
local args = select("#",...) will give you that.

Last edited by Dridzt : 11-02-10 at 07:00 PM.
  Reply With Quote