From ef4ef69b0fde77d5710d6a564a973640dfd73173 Mon Sep 17 00:00:00 2001 From: Max Cahill <1bardesign@gmail.com> Date: Fri, 19 Jan 2024 10:25:04 +1100 Subject: [PATCH] made vector metamethods not do inplace modifications (was completely unsafe and i can't believe i missed it on review :D sorry folks) --- vec2.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/vec2.lua b/vec2.lua index 6ad17d3..3448f7f 100644 --- a/vec2.lua +++ b/vec2.lua @@ -455,28 +455,28 @@ end -- meta functions for mathmatical operations function vec2.__add(a, b) - return a:vector_add_inplace(b) + return a:vector_add(b) end function vec2.__sub(a, b) - return a:vector_sub_inplace(b) + return a:vector_sub(b) end function vec2.__mul(a, b) if type(a) == "number" then - return b:scalar_mul_inplace(a) + return b:scalar_mul(a) elseif type(b) == "number" then - return a:scalar_mul_inplace(b) + return a:scalar_mul(b) else - return a:vector_mul_inplace(b) + return a:vector_mul(b) end end function vec2.__div(a, b) if type(b) == "number" then - return a:scalar_div_inplace(b) + return a:scalar_div(b) else - return a:vector_div_inplace(b) + return a:vector_div(b) end end