diff --git a/modules/bound2.lua b/modules/bound2.lua index c3639c8..8c049a4 100644 --- a/modules/bound2.lua +++ b/modules/bound2.lua @@ -152,6 +152,13 @@ function bound2.contains(a, v) and a.max.x >= v.x and a.max.y >= v.y end +--- Return a formatted string. +-- @tparam bound2 a bound to be turned into a string +-- @treturn string formatted +function bound2.to_string(a) + return string.format("(%s-%s)", a.min, a.max) +end + bound2_mt.__index = bound2 bound2_mt.__tostring = bound2.to_string diff --git a/modules/bound3.lua b/modules/bound3.lua index 4209f84..397640c 100644 --- a/modules/bound3.lua +++ b/modules/bound3.lua @@ -152,6 +152,13 @@ function bound3.contains(a, v) and a.max.x >= v.x and a.max.y >= v.y and a.max.z >= v.z end +--- Return a formatted string. +-- @tparam bound3 a bound to be turned into a string +-- @treturn string formatted +function bound3.to_string(a) + return string.format("(%s-%s)", a.min, a.max) +end + bound3_mt.__index = bound3 bound3_mt.__tostring = bound3.to_string