m
Move page script moved page USERAPI GetReturnValues to WoW:USERAPI GetReturnValues without leaving a redirect
m (It's new) |
m (Move page script moved page USERAPI GetReturnValues to WoW:USERAPI GetReturnValues without leaving a redirect) |
||
| (6 intermediate revisions by 5 users not shown) | |||
| Line 1: | Line 1: | ||
{{userfunc}} <!-- Leave this line in! --> | {{userfunc}} <!-- Leave this line in! --> | ||
Returns a list of values in whatever order you specify in ''order'' and only those you specify in ''order''. Mostly useful for functions that return multiple values. | Returns a list of values in whatever order you specify in ''order'' and only those you specify in ''order''. Mostly useful for functions that return multiple values. | ||
ret1, ret2, ... retN = {{PAGENAME}}(order, functionCall) | ret1, ret2, ... retN = {{PAGENAME}}(order, functionCall) | ||
* ''Note:'' the efficiency of this approach is questioned. See the [[Talk:{{PAGENAME}}|{{discussiontab}} page]]. | |||
== Function Parameters == | == Function Parameters == | ||
| Line 41: | Line 41: | ||
<!-- Paste your function(s) here. Make sure to prefix each line with at least one space. You may want to replace some troublesome characters with HTML entities when necessary, e.g. "<" becomes <, etc.. --> | <!-- Paste your function(s) here. Make sure to prefix each line with at least one space. You may want to replace some troublesome characters with HTML entities when necessary, e.g. "<" becomes <, etc.. --> | ||
local output = {} | |||
function {{PAGENAME}}(order, ...) | function {{PAGENAME}}(order, ...) | ||
output = wipe(output) | |||
order = tostring(order) | |||
order = tostring(order) | |||
for i=1, strlen(order) do | for i=1, strlen(order) do | ||
local | local value = select(tonumber(strsub(order, i, i)), ...) | ||
if | if value ~= nil then | ||
table.insert( | table.insert(output, value) | ||
end | end | ||
end | end | ||
return unpack( | return unpack(output) | ||
end | end | ||
__NOTOC__ | __NOTOC__ | ||
[[Category:User | [[Category:User defined functions]] | ||