Lore archive · Warcraft Wiki, 2023 dump
GetReturnValues
Last wiki revision 2008-12-24
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 = (order, functionCall)
- Note: the efficiency of this approach is questioned. See the page.
- (order, functionCall)
- order : number or numeric string
- e.g. 17 or "17"
- functionCall : a function call that returns a list of values.
- e.g GetItemInfo(itemLink)
- the number of and order of return values depend on the number specified in order and on the function passed to functionCall
local sName, iRarity, sType, iStackCount = (1368, GetItemInfo(16846)); message(sName..","..iRarity..","..sType..","..iStackCount);
Giantstalker's Helmet,4,Armor,1.
- will return the first, third, sixth, and eighth return values (in that order) from GetItemInfo(16846)
- A message box will pop-up with -
local reason, name = (61, GetAddOnInfo("Uber Addon")); if reason then _ERRORMESSAGE(name.." didn't load.\nReason code: "..reason.."."); end
Uber Addon didn't load. Reason code: MISSING
- will return the sixth and first return values (in that order) from GetAddOnInfo("Uber Addon")
- A error message box will pop-up with -
local output = {} function (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) end end return unpack(output) end
Categories
- User defined functions
Source
https://warcraft.wiki.gg/wiki/GetReturnValues · retrieved 2023-11-13 · CC BY-SA 4.0
Converted from wikitext with templates, tables and images removed, so some sentences may be missing values.
This archive predates WoW: Forever. For collected gameplay facts see the Forever database. Search the archive.