m
Move page script moved page API select to WoW:API select without leaving a redirect
m (Cleanup) |
m (Move page script moved page API select to WoW:API select without leaving a redirect) |
||
| (2 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
{{wowlua}} | |||
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). | 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) | local ret1, ret2, retN = select(index, list) | ||
| Line 4: | Line 5: | ||
== Arguments == | == Arguments == | ||
=== Parameters === | === Parameters === | ||
:;index : Any non-zero number or the string "#". | :;index | ||
:;list : Usually an ellipsis (...). | :: Any non-zero number or the string "#". | ||
:;list | |||
:: Usually an ellipsis (...). | |||
=== Returns === | === Returns === | ||
:;retN : The number of items in the list or every value starting from index to the end of the list. | :;retN | ||
:: The number of items in the list or every value starting from index to the end of the list. | |||
== Examples == | == Examples == | ||
| Line 28: | Line 32: | ||
=== Catenation === | === Catenation === | ||
select can be used to catenate a vararg list into an array. | 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(...) | function MyAddon_Catenate(...) | ||
| Line 57: | Line 61: | ||
-- number 2 | -- number 2 | ||
DEFAULT_CHAT_FRAME:AddMessage(select(1, ...))</pre> | DEFAULT_CHAT_FRAME:AddMessage(select(1, ...))</pre> | ||