API select

Used to traverse a list. This function is usually used to capture the arguments passed to an ellipsis (...). The official usage of this function is to return a list (retN) starting from index to the end of the list (list). local ret1, ret2, retN = select(index, list)

Parameters

 * index : Any non-zero number or the string "#".
 * list : Usually an ellipsis (...).

Returns

 * retN : The number of items in the list or every value starting from index to the end of the list.

Examples
-- Common usage. local num = select('#', ...) -- Returns the number of arguments in the ellipsis. local arg = select(i, ...) -- Returns the value at index i.

-- Print all of the function's arguments (those passed to the ellipsis (...) only) to the default chat frame. local msg for i = 1, select('#', ...) do    msg = select(i, ...) DEFAULT_CHAT_FRAME:AddMessage(msg) end

local a, b, c = select(2, 'a', 'b', 'c') -- a = 'b' -- b = 'c' -- c = nil

Catenation
select can be used to catenate a vararg list into an array. This is useful for returning info from GetBinding, which returns a vararg list of unknown size.

function MyAddon_Catenate(...) local t,v t = {} for i = 1, select("#", ...) do        v = select(i, ...) tinsert(t, v)    end return t end