inrange function

I know theres an inrange function that works with vectors in E2, but there doesnt seem to be one in lua. Could someone make one, or show me how to? Thanks :slight_smile:

[editline]03:43PM[/editline]

like, i have a vector Vector(10,0,-10) and i want to see if it is between two other vectors, so i would do inrange(Vector(10,0,-10), Vector(20,0,-20),Vector(-20,0,20)) and it would return true.

[lua]function _R.Vector:InRange(v1, v2)
return self.x >= v1.x and self.x <= v2.x and self.y >= v1.y and self.y <= v2.y and self.z >= v1.z and self.z <= v2.z;
end[/lua]

You would use it like this:

[lua]local V = Vector(10, 0, -10)
print(V:InRange(Vector(20, 0, -20), Vector(-20, 0, 20))[/lua]

[editline]07:15PM[/editline]

Vector:InRange(min, max)

Thank youuuuu

Youโ€™re welcome.