WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   GetActionInfo doesnt work properly? (https://www.wowinterface.com/forums/showthread.php?t=59706)

Blandros 11-07-23 03:07 PM

GetActionInfo doesnt work properly?
 
Hi,

if i do in my addon:

Lua Code:
  1. if slot then
  2.     button.icon:SetTexture(GetActionTexture(slot))
  3.     button.icon:SetTexCoord(0.1, 0.9, 0.1, 0.9)
  4.     button.icon:Show()
  5.     button.slot = slot
  6.     print(GetActionInfo(slot))
  7. end

the print says:

Quote:

macro 121
macro 122
item 156833
spell 116 spell
macro 122
macro 122
macro 122

But when i do:

Lua Code:
  1. if slot then
  2.     button.icon:SetTexture(GetActionTexture(slot))
  3.     button.icon:SetTexCoord(0.1, 0.9, 0.1, 0.9)
  4.     button.icon:Show()
  5.     button.slot = slot
  6.     local body = GetActionInfo(slot)
  7.     print(body)
  8. end

the print says:

Quote:

macro
macro
item
spell
nil
macro
macro
nil
nil
nil
nil
nil
nil
nil
nil
macro
nil
nil
why ? :confused:

I need the number of the macro..

Thank in advance!

Xrystal 11-07-23 04:00 PM

Looks like the function has multiple return values. In the first code block you were printing everything that the function returns, on the second one you are grabbing the first value ( type ) and not the second value (id)

actionType, id, subType = GetActionInfo(slot)

https://warcraft.wiki.gg/wiki/API_GetActionInfo

Fizzlemizz 11-07-23 05:57 PM

Probably more like:
Lua Code:
  1. local body = select(3, GetMacroInfo(select(2, GetActionInfo(slot))))
  2. print(body)

Blandros 11-14-23 06:35 AM

Once again @Xrystal and @Fizzlemizz thank you for your answers! You got me on the right track :)


All times are GMT -6. The time now is 08:50 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI