Thread Tools Display Modes
11-07-23, 03:07 PM   #1
Blandros
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Sep 2023
Posts: 13
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:

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:

macro
macro
item
spell
nil
macro
macro
nil
nil
nil
nil
nil
nil
nil
nil
macro
nil
nil
why ?

I need the number of the macro..

Thank in advance!
  Reply With Quote
11-07-23, 04:00 PM   #2
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,928
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
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818
  Reply With Quote
11-07-23, 05:57 PM   #3
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
Probably more like:
Lua Code:
  1. local body = select(3, GetMacroInfo(select(2, GetActionInfo(slot))))
  2. print(body)
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 11-07-23 at 06:02 PM.
  Reply With Quote
11-14-23, 06:35 AM   #4
Blandros
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Sep 2023
Posts: 13
Once again @Xrystal and @Fizzlemizz thank you for your answers! You got me on the right track
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » GetActionInfo doesnt work properly?


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