Originally Posted by liquidbase
with (maxXP == 0) the script throw a error if I want to display the value in a tooltip because of the nil-value.
|
If you're combining both mine and Torhal's conditions, there may be unexpected results depending on how you write it. It will need to look like this.
Code:
local percXP = (maxXP == 0) and 0 or math.floor((XP / maxXP) * 100)
Otherwise, I don't see how it's possible that a
nil can pass through without throwing another error at this line.
If you post your entire code, we'll be able to help better and may catch problems that you might not see.