Talk:API select

So I'm admittedly a Lua n00b, but does anybody know what the difference is between the MyAddon_Catenate(...) function on this page and { ... } ? Or does {...} not work in WoW for some reason? Lazen (talk) 15:58, 21 April 2009 (UTC)

{...} -- table construct. Collects everything in the list and puts it into a table.

local function DoStuff(...) return {...} end local t = DoStuff("a", "b", 5) for _, v in pairs(t) do    print(v) end -- the above prints: a b 5

local function DoStuff(...) for i = 1, select("#", ...) do        print((select(i, ...))) end end DoStuff("a", "b", 5) -- the above prints: a b 5

The second is more efficient in that it doesn't make a new table whenever DoStuff is called.