mirror of
https://github.com/vrld/hump.git
synced 2024-12-06 13:24:21 +00:00
Add floor division to hump.vector and hump.vector-light
This commit is contained in:
parent
9be68e9e10
commit
aa81292733
@ -38,6 +38,10 @@ local function div(s, x,y)
|
|||||||
return x/s, y/s
|
return x/s, y/s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function idiv(s, x,y)
|
||||||
|
return x//s, y//s
|
||||||
|
end
|
||||||
|
|
||||||
local function add(x1,y1, x2,y2)
|
local function add(x1,y1, x2,y2)
|
||||||
return x1+x2, y1+y2
|
return x1+x2, y1+y2
|
||||||
end
|
end
|
||||||
|
@ -97,6 +97,11 @@ function vector.__div(a,b)
|
|||||||
return new(a.x / b, a.y / b)
|
return new(a.x / b, a.y / b)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function vector.__idiv(a,b)
|
||||||
|
assert(isvector(a) and type(b) == "number", "wrong argument types (expected <vector> / <number>)")
|
||||||
|
return new(a.x // b, a.y // b)
|
||||||
|
end
|
||||||
|
|
||||||
function vector.__eq(a,b)
|
function vector.__eq(a,b)
|
||||||
return a.x == b.x and a.y == b.y
|
return a.x == b.x and a.y == b.y
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user