mirror of
https://github.com/OgelGames/fakelib.git
synced 2025-07-11 04:40:40 +02:00
add vector check
This commit is contained in:
10
misc.lua
Normal file
10
misc.lua
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
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
|
Reference in New Issue
Block a user