How to check for "no value"?

Hello,

So I have a part of code that looks like this:

if particle.scale then

particleEffect:scale(particle.scale)

end

And I’ve recently received an error:

[…]\classes\FightView.lua:123: bad argument #2 to ‘scale’ (number expected, got no value)

So here’s my question - how can check if variable has a value (looks like the "if particle.scale […]" check doesn’t work) and what’s the difference between “no value” and “nil” in LUA?

that error means that a required parameter is missing.  you didn’t post enough code for us to know what “particleEffect” is, but if “particleEffect” is a display object, then its scale() method requires two arguments.  the C API can distinguish “argument provided but nil” from “argument not provided”.

Normally :scale() requires two params - one for x and one for y.

Does particleEffect:scale(particle.scale, particle.scale**)** work for you?

that error means that a required parameter is missing.  you didn’t post enough code for us to know what “particleEffect” is, but if “particleEffect” is a display object, then its scale() method requires two arguments.  the C API can distinguish “argument provided but nil” from “argument not provided”.

Normally :scale() requires two params - one for x and one for y.

Does particleEffect:scale(particle.scale, particle.scale**)** work for you?