WoW:API select: Difference between revisions

430 bytes added ,  18 December 2008
Updated with new information - Added example function
mNo edit summary
(Updated with new information - Added example function)
Line 24: Line 24:
  -- b = 'c'
  -- b = 'c'
  -- c = nil
  -- c = nil
=== Catenation ===
select can be used to catenate a vararg list into an array.  This is useful for returning info from [[API_GetBinding | GetBinding]], which returns a vararg list of unknown size.
function MyAddon_Catenate(...)
local t,n,i,v;
n=select("#",...);
t={};
for i=1,n do
v=select(i, ...); -- Have to save to a variable before adding to get each element separately
tinsert(t,v);
end
return t;
end


== Notes ==
== Notes ==
Anonymous user