Thread Tools Display Modes
Prev Previous Post   Next Post Next
10/12/14, 04:17 PM   #1
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Return function with multiple returns

Is it possible to return all of the return values from a "different" function that has multiple returns in a single return statement?

Like:
Lua Code:
  1. local function somefunc(_iBagId, _iSlotId,)
  2.   -- This might seem pointless, but I wanted an example people would be familiar with --
  3.    return GetItemInfo(_iBagId, _iSlotId)
  4. end
and then call that function and capture everything like:
Lua Code:
  1. local sIcon, iStack, iSellPrice, bMeetsUsageRequirement, bLocked, iEquipType, iItemStyle, iItemQuality = somefunc(bagId, slotId)

or do you have to capture all of the returns and then return them like:
Lua Code:
  1. local function somefunc(_iBagId, _iSlotId,)
  2.    local sIcon, iStack, iSellPrice, bMeetsUsageRequirement, bLocked, iEquipType, iItemStyle, iItemQuality = GetItemInfo(_iBagId, _iSlotId)
  3.    return sIcon, iStack, iSellPrice, bMeetsUsageRequirement, bLocked, iEquipType, iItemStyle, iItemQuality
  4. end
I tried googling for the answer, but no luck.
  Reply With Quote
 

ESOUI » Developer Discussions » Lua/XML Help » Return function with multiple returns


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off