SpellMixin

From Warcraft Wiki
Jump to navigation Jump to search

The SpellMixin interface was added to get spell data without the risk of it returning empty data.[1]

Source: FrameXML\ObjectAPI\Spell.lua

API

Methods

ContinueOnSpellLoad

Some spell data - such as subtext and description - are load on demand. You can use SpellMixin:ContinueOnSpellLoad() to asynchronously query the data.

local spell = Spell:CreateFromSpellID(139)

spell:ContinueOnSpellLoad(function()
	local name = spell:GetSpellName()
	local desc = spell:GetSpellDescription()
	print(name, desc) -- "Renew", "Fill the target with faith in the light, healing for 295 over 15 sec."
end)


Warning Warning: Certain spells might not return information when using :ContinueOnSpellLoad. For example spellID 10444 will return info for GetSpellInfo and C_Spell.RequestLoadSpellData but SPELL_DATA_LOAD_RESULT will have success:false, possibly because of an error with other data like the spell description.
This will make :ContinueOnSpellLoad never fire the callback. One workaround is to use :ContinueWithCancelOnSpellLoad with a timeout or directly listen to SPELL_DATA_LOAD_RESULT.

Patch changes

See also

External links

References