From 76cdaa8c6b488a883747c1b53ca42030b38d80b0 Mon Sep 17 00:00:00 2001 From: mcc Date: Fri, 29 Nov 2019 11:33:21 -0500 Subject: [PATCH] to_string methods for bound2 and bound3 --- modules/bound2.lua | 7 +++++++ modules/bound3.lua | 7 +++++++ 2 files changed, 14 insertions(+) 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