From 40173b264707e28f48e1364e696d9c1bd40d9828 Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Sun, 4 Jul 2021 23:30:29 +0100 Subject: [PATCH] Vector3: default to 0 for unspecified args --- worldeditadditions/utils/vector3.lua | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/worldeditadditions/utils/vector3.lua b/worldeditadditions/utils/vector3.lua index 4acc92f..252b49d 100644 --- a/worldeditadditions/utils/vector3.lua +++ b/worldeditadditions/utils/vector3.lua @@ -8,15 +8,9 @@ Vector3.__index = Vector3 -- @param y number The y co-ordinate value. -- @param z number The z co-ordinate value. function Vector3.new(x, y, z) - if type(x) ~= "number" then - error("Error: Expected number for the value of x, but received argument of type "..type(x)..".") - end - if type(y) ~= "number" then - error("Error: Expected number for the value of y, but received argument of type "..type(y)..".") - end - if type(z) ~= "number" then - error("Error: Expected number for the value of z, but received argument of type "..type(z)..".") - end + x = x or 0 + y = y or 0 + z = z or 0 local result = { x = x,