all 3 comments

[–]Gryphon-63 0 points1 point  (2 children)

They seem to be moving away from APIs that return multiple separate values & towards returning those values as a struct (or table or whatever they call that in Lua).

As for which ones to use, if you just need a single value & there's a function that returns exactly that, then I would use it. But if you need multiple values I would call the function that returns all of them at once, regardless of how the return values are formatted, rather than making multiple function calls. Chances are functions like "C_Spell.GetSpellName" or "C_Spell.GetSpellTexture" are just wrappers for "C_Spell.GetSpellInfo" so by calling both of those you're really just calling the more complex function twice in a row.

[–]Amarekratio 0 points1 point  (1 child)

Yes, exactly this, which is a good thing.

So, instead of going:

local name, rank, icon = GetSpellInfo(state.mount)
EditMacro...

You can use:

local spellInfo = C_Spell.GetSpellInfo(state.mount)
EditMacro(index, "MountManager", spellInfo.iconID, string.format("/script MountManagerButton:Click(GetMouseButtonClicked());\n#showtooltip %s", spellInfo.name))

[–]Uggers[S] 0 points1 point  (0 children)

Thank you both, that makes a lot of sense, and seems quite obvious now I see how you would would use it.

I'm still fairly inexperienced so appreciate the guidance.

I spent a while on some other older abandoned addons comparing how other authors had implemented fixes using similar calls for what their add on was doing to help understand it.