vrld / hump

LÖVE Helper Utilities for Massive Progression
http://hump.readthedocs.org
1.09k stars 154 forks source link

changed the isvector() function in vector.lua #108

Closed automattf closed 6 years ago

automattf commented 6 years ago

I've changed the isvector() function inside vector.lua. Instead of checking that v is a table with number values of x and y, it checks if the meta table of v is vector, since any Vector object has vector as a meta table as defined in the new function. This way has a 100% accuracy of checking if it is a Vector object, whereas before any table with an x and y could have passed.

I'm not sure if you have it this way on purpose, due to speed or some other factor; if so, just shoot me down.

Have a good day :)

vrld commented 6 years ago

The "soft" implementation of isvector() is intentional. This way, you can do vector math with vectors and other objects that have x/y components.