Marco Dittrich
Marco Dittrich

Reputation: 5

Expected String, got nil

I have the following code which should just print a number, but instead it prints the mentioned error:

print(
  math.abs(
    tonumber(TColor, 16) -
    tonumber(FColor, 16)
  ) / 100 * (math.abs(minV - maxV) / 100 * curV) + tonumber(FColor, 16)
)

even tostring( math...... ) couldn't solve it

Upvotes: 0

Views: 494

Answers (1)

hjpotter92
hjpotter92

Reputation: 80657

The error occurs because one of the Tcolor or Fcolor is nil. The error is being thrown by tonumber().

You can see it being reproduced here.

Upvotes: 2

Related Questions