RSA

RSA

3M Downloads

[Bug]: Monitor.lua attempt to call global 'GetSpellLink' (a nil value)

aromagnoli opened this issue ยท 4 comments

commented

Description

I expected no errors, but the monitor.lua is throwing some errors.

RSA Version

RSA 5.2

World of Warcraft Flavor

Dragonflight

Lua Error

6x RSA/Tools/Monitor.lua:223: attempt to call global 'GetSpellLink' (a nil value)
[string "@RSA/Tools/Monitor.lua"]:223: in function `ProcessSpell'
[string "@RSA/Tools/Monitor.lua"]:448: in function <RSA/Tools/Monitor.lua:409>

Locals:
profileName = "bodyAndSoul"
extraSpellID = "BUFF"
extraSpellName = nil
extraSchool = nil
timestamp = 1721813689.751000
event = "SPELL_AURA_APPLIED"
hideCaster = false
sourceGUID = "Dummy"
sourceName = "Dummy"
sourceFlags = 1297
sourceRaidFlag = 0
destGUID = "Dummy"
destName = "Dummy"
destFlags = 1297
destRaidFlags = 0
spellID = 65081
spellName = "Body and Soul"
spellSchool = 2
ex1 = "BUFF"
ex2 = nil
ex3 = nil
ex4 = nil
ex5 = nil
ex6 = nil
ex7 = nil
ex8 = nil
currentSpell = <table> {
 configDisplay = <table> {
 }
 events = <table> {
 }
 spellID = 65081
 additionalSpellIDs = <table> {
 }
 environments = <table> {
 }
}
fakeEvent = nil
message = "[LINK] cast on [TARGET]!"
tagSpellName = "Body and Soul"
tagSpellLink = nil
(*temporary) = nil
(*temporary) = 65081
(*temporary) = "attempt to call global 'GetSpellLink' (a nil value)"
RSA = <table> {
 modules = <table> {
 }
 baseName = "RSA"
 configData = <table> {
 }
 defaultModuleState = true
 Monitor = <table> {
 }
 db = <table> {
 }
 enabledState = true
 defaultModuleLibraries = <table> {
 }
 name = "RSA"
 orderedModules = <table> {
 }
 Comm = <table> {
 }
 Options = <table> {
 }
 monitorData = <table> {
 }
 SendMessage = <table> {
 }
}
uClass = "priest"
cacheTagSpellName = <table> {
 65081 = "Body and Soul"
}
cacheTagSpellLink = <table> {
}
replacements = <table> {
}
missTypes = <table> {
 1 = "ABSORB"
 2 = "BLOCK"
 3 = "DEFLECT"
 4 = "DODGE"
 5 = "EVADE"
 6 = "IMMUNE"
 7 = "MISS"
 8 = "PARRY"
 9 = "REFLECT"
 10 = "RESIST"
}

Reproduction Steps

As a priest.

Cast Power Word: Shield on yourself with the addon loaded.

Screenshots

No response

commented

Same behavior when casting a teleport spell as a mage.

At a glance, GetSpellLink and C_SpellBook.GetSpellLinkFromSpellID both seem to have been renamed/moved/removed. :(

commented

Same behavior when casting a teleport spell as a mage.

At a glance, GetSpellLink and C_SpellBook.GetSpellLinkFromSpellID both seem to have been renamed/moved/removed. :(

Both have been removed with 11.0.0 release.

To fix the Lua error:

  1. Open Monitor.lua file.
  2. Edit the following lines of code:
  • Line 223: Change tagSpellLink = GetSpellLink(spellID) to tagSpellLink = C_Spell.GetSpellLink(spellID)
  • Line 233: Change tagSpellLink = GetSpellLink(parentSpell) to tagSpellLink = C_Spell.GetSpellLink(parentSpell)
  • Line 267: Change link = GetSpellLink(extraSpellID) to link = C_Spell.GetSpellLink(extraSpellID)
commented

Should be fixed in 5.3

commented

Unfortunately still present in 5.3. (I've no idea whether comments on closed issues will notify @Caedilla )

28x RSA/Tools/Monitor.lua:237: attempt to call global 'GetSpellLink' (a nil value)
[string "@RSA/Tools/Monitor.lua"]:237: in function `ProcessSpell'
[string "@RSA/Tools/Monitor.lua"]:452: in function <RSA/Tools/Monitor.lua:413>

Locals:
InCombatSkipped

The same error is also reported on line 271. Both locations are trying to call the old function.

I've been playing with this change locally; it bubbles out the old-versus-new decision to only running once, at load, for the entire file, rather than repeatedly on each call. So far no problems:

$ diff -ub RSA/Tools/Monitor.lua.orig RSA/Tools/Monitor.lua
--- RSA/Tools/Monitor.lua.orig  2024-08-22 00:02:31.845999800 -0400
+++ RSA/Tools/Monitor.lua       2024-08-22 00:04:13.572699100 -0400
@@ -22,6 +22,12 @@
        'RESIST',
 }

+local GetSpellLink = _G.GetSpellLink
+if not GetSpellLink then
+       GetSpellLink = C_Spell.GetSpellLink
+end
+
+
 local function CommCheck(currentSpell)
        -- Track group announced spells using RSA.Comm (AddonMessages)
        local canAnnounce = true
@@ -220,11 +226,7 @@

        local tagSpellLink = cacheTagSpellLink[spellID]
        if not tagSpellLink then
-               if GetSpellLink then
                        tagSpellLink = GetSpellLink(spellID)
-               else
-                       tagSpellLink = C_Spell.GetSpellLink(spellID)
-               end
                cacheTagSpellLink[spellID] = tagSpellLink
        end