Issue #356 resolved

rayCast raises a confusing error message when callback returns nothing

Aidan Gauland
created an issue

If the callback function passed to World:rayCast() does not return anything, it raises a rather cryptic error:

bad argument #-2 to 'rayCast' (number expected, got nil)

I have attached a simple, single-file Love program that demonstrates this. In the program, move the blue ball (on the right) next to the red ball and hit 'Q'. The problem is on line 57, which should instead be (function(...) return rayCastCallback(objects.hitter, ...) end))