garden/util.lua

10 lines
181 B
Lua

local m = {}
function m.between(x, a, b)
return a <= x and x <= b
end
function m.inside(px, py, x, y, w, h)
return m.between(px, x, x+w) and
m.between(py, y, y+h)
end