Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isvector breaks when two vectors are created from different vector instances #35

Closed
karai17 opened this issue Jun 23, 2014 · 1 comment

Comments

@karai17
Copy link
Contributor

karai17 commented Jun 23, 2014

local Vector = require "libs.hump.vector"
local Vec2 = require "libs.something_else.third_party.hump.vector"

local vertex1 = Vector(50, 50)
local vertex2 = Vec2(100, 100)

local sum = vertex1 + vertex2 -- crash!

I am using a library that has an internal instance of Vector, and I am needing to do some math with a local copy of Vector. The problem is, when isvector checks if they are both vectors (they are!), it decides that they aren't due to them coming from different instances of Vector.

Perhaps a fix for this would be to check the data structure's integrity instead of a pointer to the Vector library?

vrld pushed a commit that referenced this issue Aug 22, 2014
Now returns true if `v' is a table and both `v.x' and `v.y' are numbers.
@vrld
Copy link
Owner

vrld commented Aug 22, 2014

Fixed at last :)

@vrld vrld closed this as completed Aug 22, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants