Thread Tools Display Modes
Prev Previous Post   Next Post Next
01-10-21, 05:40 AM   #1
Nattugglan
A Defias Bandit
Join Date: Sep 2010
Posts: 2
attempt to compare number with nil

Getting the "error attempt to compare number with nil" with my very simply weakaura that shows my rested experience.

Error:
12x [string "--[==[ Error in 'DataTexts-Rested%':'custom..."]:5: attempt to compare number with nil
[string "=[C]"]: in function `xpcall'
[string "@WeakAuras\WeakAuras-3.1.8.lua"]:4073: in function `RunCustomTextFunc'
[string "@WeakAuras\RegionTypes\Text.lua"]:219: in function `FrameTick'
[string "@WeakAuras\RegionTypes\RegionPrototype.lua"]:646: in function <...aceWeakAuras\RegionTypes\RegionPrototype.lua:638>

My code:
function()
local restedxp = GetXPExhaustion()
local totalXP = UnitXPMax("player")
if restedxp == 0 then return end
if restedxp > 0 then percent = floor((restedxp / totalXP) * 100) end

local ret = string.format("%d%%", percent)
return ret
end

Need help please! : )
  Reply With Quote
 

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » attempt to compare number with nil


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