fakelib/misc.lua
2024-05-19 15:23:58 +10:00

11 lines
290 B
Lua

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