diff --git a/modules/bound2.lua b/modules/bound2.lua index c3639c8..22da310 100644 --- a/modules/bound2.lua +++ b/modules/bound2.lua @@ -160,7 +160,9 @@ function bound2_mt.__call(_, a, b) end if status then - ffi.metatype(new, bound2_mt) + xpcall(function() -- Allow this to silently fail; assume failure means someone messed with package.loaded + ffi.metatype(new, bound2_mt) + end, function() end) end return setmetatable({}, bound2_mt) diff --git a/modules/bound3.lua b/modules/bound3.lua index 4209f84..8c26236 100644 --- a/modules/bound3.lua +++ b/modules/bound3.lua @@ -160,7 +160,9 @@ function bound3_mt.__call(_, a, b) end if status then - ffi.metatype(new, bound3_mt) + xpcall(function() -- Allow this to silently fail; assume failure means someone messed with package.loaded + ffi.metatype(new, bound3_mt) + end, function() end) end return setmetatable({}, bound3_mt) diff --git a/modules/mat4.lua b/modules/mat4.lua index 67a09ba..3cd06f5 100644 --- a/modules/mat4.lua +++ b/modules/mat4.lua @@ -853,7 +853,9 @@ function mat4_mt.__mul(a, b) end if status then - ffi.metatype(new, mat4_mt) + xpcall(function() -- Allow this to silently fail; assume failure means someone messed with package.loaded + ffi.metatype(new, mat4_mt) + end, function() end) end return setmetatable({}, mat4_mt) diff --git a/modules/quat.lua b/modules/quat.lua index 1cd1de7..e8ea330 100644 --- a/modules/quat.lua +++ b/modules/quat.lua @@ -469,7 +469,9 @@ function quat_mt.__pow(a, n) end if status then - ffi.metatype(new, quat_mt) + xpcall(function() -- Allow this to silently fail; assume failure means someone messed with package.loaded + ffi.metatype(new, quat_mt) + end, function() end) end return setmetatable({}, quat_mt) diff --git a/modules/vec2.lua b/modules/vec2.lua index cfc0653..d7a0786 100644 --- a/modules/vec2.lua +++ b/modules/vec2.lua @@ -381,7 +381,9 @@ function vec2_mt.__div(a, b) end if status then - ffi.metatype(new, vec2_mt) + xpcall(function() -- Allow this to silently fail; assume failure means someone messed with package.loaded + ffi.metatype(new, vec2_mt) + end, function() end) end return setmetatable({}, vec2_mt) diff --git a/modules/vec3.lua b/modules/vec3.lua index 97b7f80..95c96eb 100644 --- a/modules/vec3.lua +++ b/modules/vec3.lua @@ -361,7 +361,9 @@ function vec3_mt.__div(a, b) end if status then - ffi.metatype(new, vec3_mt) + xpcall(function() -- Allow this to silently fail; assume failure means someone messed with package.loaded + ffi.metatype(new, vec3_mt) + end, function() end) end return setmetatable({}, vec3_mt)