#Lua Error on C_Spell.GetSpellCooldown & C_Spell.GetSpellCharges

10 messages · Page 1 of 1 (latest)

austere sandal
#

getting this error on this piece of coding

#
WeakAuras Version: 5.17.0
Aura Version: 1.0.0
Stack trace:
[string "return function() aura_env.inStealth = fals..."]:183: attempt to perform arithmetic on a table value
[string "return function() aura_env.inStealth = false"]:183: in function `?'
[string "return function( as, e, tr, ts )"]:41: in function <[string "return function( as, e, tr, ts )"]:1>
[string "=[C]"]: in function `xpcall'
[string "@WeakAuras/GenericTrigger.lua"]:672: in function <WeakAuras/GenericTrigger.lua:657>
[string "@WeakAuras/GenericTrigger.lua"]:1004: in function `ScanEventsWatchedTrigger'
[string "@WeakAuras/WeakAuras.lua"]:4801: in function `SendDelayedWatchedTriggers'
[string "@WeakAuras/WeakAuras.lua"]:4912: in function `UpdatedTriggerState'
[string "@WeakAuras/BuffTrigger2.lua"]:2003: in function <WeakAuras/BuffTrigger2.lua:1995>
[string "@WeakAuras/BuffTrigger2.lua"]:2487: in function <WeakAuras/BuffTrigger2.lua:2480>

Locals:
as = <table> {
 needTea = false
 progressType = "timed"
 changed = true
 poisonStack = 0
 expirationTime = 37431.874000
 targetGUID = "Creature-0-4236-2552-4661-225984-0000CC6280"
 isCrit = false
 needVanish = false
 icon = 1259291
 damageText = ""
 triggernum = 1
 recordTarget = ""
 stacksText = ""
 newRecord = false
 grade = 0
 totalDamage = 278064
 show = true
 id = "Kingsbane Damage 2"
 trigger = <table> {
 }
 nightstalker = true
 showRecordText = false
 kingsbaneExpired = false
 duration = 14
}
ts = <table> {
  = <table> {
 }
}
(*temporary) = 37428.885000
(*temporary) = <table> {
 isEnabled = true
 startTime = 0
 modRate = 1
 duration = 0
}
(*temporary) = 1
(*temporary) = <table> {
 isEnabled = true
 startTime = 0
 modRate = 1
 duration = 0
}
(*temporary) = 360194
(*temporary) = "attempt to perform arithmetic on a table value"
#
    [11] = function(as, ts)
        if aura_env.masterAssassinTalent then
            if ts[""] then
                -- only show vanish glow if DM is active
                local secondsSinceDeathmarkStart = GetTime() - select(1, C_Spell.GetSpellCooldown(360194))
                if secondsSinceDeathmarkStart <= 16 then as.needVanish = true end 
            end
        end
    end,
    
    -- 6 seconds remaining on KB
    [12] = function(as, ts)
        if aura_env.masterAssassinTalent then
            if ts[""] then
                local currentCharges = select(1, C_Spell.GetSpellCharges(381623)) -- Tea charges
                if currentCharges > 0 then as.needTea = true end -- only show tea glow if tea ready
            end
        end
    end,
    
    -- Thistle tea buff applied
    [13] = function(as, ts)
        if aura_env.masterAssassinTalent then
            if ts[""] then
                as.needTea = false
            end
        end
    end,```
cerulean sage
#

attempt to perform arithmetic on a table value

#

this returns a table now, not many multiple values like the old GetSpellCooldown did

#

example usage would be something like:

local cdInfo = C_Spell.GetSpellCooldown(spellId)
if cdInfo.startTime then ...

or in your case:
local secondsSinceDeathmarkStart = GetTime() - C_Spell.GetSpellCooldown(360194).startTime

#

you could also directly do C_Spell.GetSpellCooldown(spellId).startTime if you'd only wanna use it once

#

if you need it multiple times, it's better to avoid additional api calls by saving it to a local