WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Error with runes (https://www.wowinterface.com/forums/showthread.php?t=58298)

cokedrivers 10-16-20 07:25 AM

Error with runes
 
I'm getting this error any time my screen reloads:

Code:

36x BasicUI\Modules\Powerbar.lua:316: attempt to perform arithmetic on local 'start' (a nil value)
[string "@BasicUI\Modules\Powerbar.lua"]:316: in function <BasicUI\Modules\Powerbar.lua:314>
[string "@BasicUI\Modules\Powerbar.lua"]:495: in function <BasicUI\Modules\Powerbar.lua:480>

Locals:
self = 1
start = nil
duration = nil
runeReady = nil
(*temporary) = <function> defined =[C]:-1
(*temporary) = 173940.047000
(*temporary) = 173940.047000
(*temporary) = nil
(*temporary) = "attempt to perform arithmetic on local 'start' (a nil value)"
floor = <function> defined =[C]:-1

this is the code block that is coming from:
Code:

        local function CalcRuneCooldown(self)
                local start, duration, runeReady = GetRuneCooldown(self)
                local time = floor(GetTime() - start)
                local cooldown = ceil(duration - time)

                if (runeReady or UnitIsDeadOrGhost('player')) then
                        return '#'
                elseif (not UnitIsDeadOrGhost('player') and cooldown) then
                        return cooldown
                end
        end

The bold part of the code is line 316 where the error is coming from any suggestions?
Thanks
Coke

Rilgamon 10-16-20 07:41 AM

https://wow.gamepedia.com/API_GetRuneCooldown

You're calling the function with self? Is it a number as it should be?
Edit: Ah, now I see its a number. Perhaps its called too early before runes are available?

If a function can return a value you cant use in a formula you should make sure to only use it when a value valid.


All times are GMT -6. The time now is 08:21 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI