nil check for get_distance

This commit is contained in:
tenplus1 2020-07-20 07:27:55 +01:00
parent f033cd401c
commit 4814f53885
1 changed files with 1 additions and 1 deletions

View File

@ -195,7 +195,7 @@ end
-- calculate distance
local get_distance = function(a, b)
if not a or not b then return 50 end -- nil check
local x, y, z = a.x - b.x, a.y - b.y, a.z - b.z
return square(x * x + y * y + z * z)