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! : ) |
GetXPExhaustion returns nil when you are not rested. So instead of
Code:
if restedxp == 0 Code:
if restedxp == nil Code:
if not restedxp |
Thanks a lot. I will try this immediately
|
All times are GMT -6. The time now is 11:31 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI