Most generic lua error ever, what do?

[lua\includes\extensions\math.lua:218] attempt to compare nil with number

I got this after trying to add some function over from one schema to another. I don’t even know where to start with fixing this.

[lua]
function math.Approach( cur, target, inc )

inc = math.abs( inc )

if (cur < target) then --THIS IS LINE 218
	
	return math.Clamp( cur + inc, cur, target )

elseif (cur > target) then

	return math.Clamp( cur - inc, target, cur )

end

return target

end
[/lua]

cur or target is nil.

Yeah, but… I have no idea which cur or target is. There’s so many to look through.

Look for where you are calling math.Approach and make sure that cur and target are valid variables.

Cur is nil according to your error.