Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
WoW
Talk
English
Views
Read
Edit
History
More
Search
Navigation
Home
Random page
Help using wiki
Editions
for WoW
for WildStar
for Solar2D
Documentation
for WoW
for WildStar
Reference
WoW
⦁ FrameXML
⦁ AddOns
⦁ API
⦁ WoW Lua
WildStar
⦁ AddOns
⦁ API
⦁ WildStar Lua
Engine
Tools
What links here
Related changes
Special pages
Page information
Site
Recent Changes
Editing
WoW:API select
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Notes == * ''list'' can be value1, value2, value3, ... valueN; although, you will never see it used in that manner since you can just access value1 through valueN directly. * It is not recommended that you use this method on a table as you would have to pass the table to [[API_unpack|unpack]]() for every call to select (once plus the number of consecutive numeric indexes). For tables, use [[API_pairs|pairs]]() or [[API_ipairs|ipairs]](). * Indexes beyond the number of list items will return nil. : <pre>select(6, 'see', 'dog', 'run') -- returns nil</pre> * An index of 0 will produce an "index out or range" error. * Negative values wrap to the end of the list. : <pre>select(-1, 1, 2, 3, 4, 5) -- returns 5</pre> * A decimal index will be rounded to the nearest integer (1.1 rounds to 1, 1.9 rounds to 2). * Passing a function that returns a list as a parameter to another function will pass each return as a parameter to the function as if you were manually passing each variable to that function, so ''tinsert(tab, select(1, ...))'', will have unpredictable results. <pre>-- these are identical -- number 1 local msg, r, g, b, a, id = select(1, ...) DEFAULT_CHAT_FRAME:AddMessage(msg, r, g, b, a, id) -- number 2 DEFAULT_CHAT_FRAME:AddMessage(select(1, ...))</pre>
Summary:
Please note that all contributions to AddOn Studio are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
AddOn Studio Wiki:Copyrights
for details).
Submissions must be written by you, or copied from a public domain or similar free resource (see
AddOn Studio Wiki:Copyrights
for details).
Cancel
Editing help
(opens in new window)