Don't assert scalars must be vectors.
authorCy <whatever>
Thu, 7 Nov 2013 03:08:18 +0000 (19:08 -0800)
committerkwolekr <kwolekr@minetest.net>
Thu, 7 Nov 2013 04:16:49 +0000 (23:16 -0500)
builtin/vector.lua

index 6b787366dc806ddc00e02c969ceea99151b810b8..77944b612111c6019ff057ae869ae65985f4eafb 100644 (file)
@@ -90,8 +90,8 @@ end
 
 function vector.add(a, b)
        assert_vector(a)
-       assert_vector(b)
        if type(b) == "table" then
+           assert_vector(b)
                return {x = a.x + b.x,
                        y = a.y + b.y,
                        z = a.z + b.z}
@@ -104,8 +104,8 @@ end
 
 function vector.subtract(a, b)
        assert_vector(a)
-       assert_vector(b)
        if type(b) == "table" then
+           assert_vector(b)
                return {x = a.x - b.x,
                        y = a.y - b.y,
                        z = a.z - b.z}
@@ -118,8 +118,8 @@ end
 
 function vector.multiply(a, b)
        assert_vector(a)
-       assert_vector(b)
        if type(b) == "table" then
+           assert_vector(b)
                return {x = a.x * b.x,
                        y = a.y * b.y,
                        z = a.z * b.z}
@@ -132,8 +132,8 @@ end
 
 function vector.divide(a, b)
        assert_vector(a)
-       assert_vector(b)
        if type(b) == "table" then
+        assert_vector(b)
                return {x = a.x / b.x,
                        y = a.y / b.y,
                        z = a.z / b.z}