Commits

Bart van Strien committed b941f61

Use a clearer error message when the raycast callback doesn't return a number (issue #356)

Comments (0)

Files changed (1)

src/modules/physics/box2d/World.cpp

 			lua_pushnumber(L, scaledNormal.y);
 			lua_pushnumber(L, fraction);
 			lua_call(L, 6, 1);
-			return (float32)luaL_checknumber(L, -1);
+			if (!lua_isnumber(L, -1))
+				luaL_error(L, "Raycast callback didn't return a number!");
+			return (float32)lua_tonumber(L, -1);
 		}
 		return 0;
 	}