Merge pull request #45 from mcclure/bound-to-string

to_string methods for bound2 and bound3
This commit is contained in:
mcclure 2019-11-29 21:20:48 -05:00 committed by GitHub
commit 3e94b3abd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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