to_string methods for bound2 and bound3

This commit is contained in:
mcc 2019-11-29 11:33:21 -05:00
parent 6c49915112
commit 76cdaa8c6b
2 changed files with 14 additions and 0 deletions

View File

@ -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

View File

@ -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