WoW:USERAPI GetReturnValues: Difference between revisions

m
Move page script moved page USERAPI GetReturnValues to WoW:USERAPI GetReturnValues without leaving a redirect
m (catfix)
m (Move page script moved page USERAPI GetReturnValues to WoW:USERAPI GetReturnValues without leaving a redirect)
 
(One intermediate revision by one other user not shown)
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 &lt;, 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 &lt;, etc.. -->


local output = {}
  function {{PAGENAME}}(order, ...)
  function {{PAGENAME}}(order, ...)
     local output = {}
     output = wipe(output)
     order = tostring(order)
     order = tostring(order)
     for i=1, strlen(order) do
     for i=1, strlen(order) do
         local value = select(tonumber(strsub(order, i, i), ...)
         local value = select(tonumber(strsub(order, i, i)), ...)
         if value ~= nil then
         if value ~= nil then
             table.insert(output, value)
             table.insert(output, value)
Line 51: Line 52:
     end
     end
     return unpack(output)
     return unpack(output)
end
Variant
local {{PAGENAME}}_Out
function {{PAGENAME}}(order, ...)
    {{PAGENAME}}_Out = {}
    order = tostring(order)
    for i=1, strlen(order) do
        local value = select(tonumber(strsub(order, i, i)), ...)
        if value ~= nil then
            table.insert({{PAGENAME}}_Out, value)
        end
    end
    return unpack({{PAGENAME}}_Out)
  end
  end


__NOTOC__
__NOTOC__
[[Category:User defined functions]]
[[Category:User defined functions]]
Anonymous user