fakelib/misc.lua

11 lines
290 B
Lua
Raw Normal View History

2024-05-19 07:23:58 +02:00
function fakelib.is_vector(x, add_metatable)
if type(x) ~= "table" or type(x.x) ~= "number" or type(x.y) ~= "number" or type(x.z) ~= "number" then
return false
end
if add_metatable and getmetatable(x) ~= vector.metatable then
setmetatable(x, vector.metatable)
end
return true
end