This page documents a user-defined function that you can copy and paste into your addon. Replace <PREFIX> with your AddOn's prefix to avoid conflicts between different versions of these functions.
User defined functions < GetReturnValues

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 = USERAPI GetReturnValues(order, functionCall)
  • Note: the efficiency of this approach is questioned. See the discussion page.

Function Parameters Edit

Arguments Edit

(order, functionCall)
number or numeric string
e.g. 17 or "17"
a function call that returns a list of values.
e.g GetItemInfo(itemLink)

Returns Edit

the number of and order of return values depend on the number specified in order and on the function passed to functionCall

Example:1 Edit

local sName, iRarity, sType, iStackCount = USERAPI GetReturnValues(1368, GetItemInfo(16846));


USERAPI GetReturnValues will return the first, third, sixth, and eighth return values (in that order) from GetItemInfo(16846)
A message box will pop-up with -
Giantstalker's Helmet,4,Armor,1.

Example:2 Edit

local reason, name = USERAPI GetReturnValues(61, GetAddOnInfo("Uber Addon"));
if reason then
    _ERRORMESSAGE(name.." didn't load.\nReason code: "..reason..".");


USERAPI GetReturnValues will return the sixth and first return values (in that order) from GetAddOnInfo("Uber Addon")
A error message box will pop-up with -
Uber Addon didn't load.
Reason code: MISSING


local output = {}
function USERAPI GetReturnValues(order, ...)
    output = wipe(output)
    order = tostring(order)
    for i=1, strlen(order) do
        local value = select(tonumber(strsub(order, i, i)), ...)
        if value ~= nil then
            table.insert(output, value)
    return unpack(output)

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.