Thread Tools Display Modes
10-16-20, 07:25 AM   #1
cokedrivers
A Rage Talon Dragon Guard
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 325
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
  Reply With Quote
10-16-20, 07:41 AM   #2
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 822
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.
__________________
The cataclysm broke the world ... and the pandas could not fix it!

Last edited by Rilgamon : 10-16-20 at 07:52 AM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Error with runes

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off