Lua Utility Functions

Check if point is within rectangle:

local function is_within_rectangle(point_x, point_y, rect_x, rect_y, rect_width, rect_height)
    return rect_x <= point_x and point_x <= rect_x + rect_width and rect_y <= point_y and point_y <= rect_y + rect_height
end