From e368ba3e0a10373ca742ea1d33127b842c7f40f2 Mon Sep 17 00:00:00 2001 From: sammyette Date: Sat, 18 Feb 2023 17:57:46 -0400 Subject: [PATCH] fix(nature/greenhouse): add limit to text offset for scrolling --- nature/greenhouse.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nature/greenhouse.lua b/nature/greenhouse.lua index fb090c1..390c454 100644 --- a/nature/greenhouse.lua +++ b/nature/greenhouse.lua @@ -35,9 +35,9 @@ end function Greenhouse:scroll(direction) if direction == 'down' then - self.offset = self.offset + 1 + self.offset = math.min(self.offset + 1, #self.lines) elseif direction == 'up' then - self.offset = self.offset - 1 + self.offset = math.max(self.offset - 1, 1) end self:draw() end