nil passed to isvector should return false
Opened this issue · 6 comments
Deleted user commented
When a nil is passed, it errors, "attempt to index v (a nil value)".
davisdude commented
Do you think it should throw a meaningful error or just return false?
Deleted user commented
Well, a nil is not a vec3, so it should return false. Erring should be the choice of the caller.
shakesoda commented
it was this way intentionally, but in hindsight it makes more sense that it'd nil check by itself. I'll take care of it.
davisdude commented
Don't know if you're planning on doing it this way or not, but I think it would be easiest to just add a simple check for truthiness at the beginning. I.e
function isvector(v)
return v and -- ...
end
edit never mind, you have to do other type checking as well, so not really worth it to do that. It would be easier to just check if v is a table
davisdude commented
@shakesoda I went ahead and fixed it via commit 112
shakesoda commented
thanks!