From 0b53745c4d1c04d28939ea5cd93e700474f953a0 Mon Sep 17 00:00:00 2001 From: ywang Date: Wed, 11 Aug 2021 00:01:53 +0200 Subject: Minor bugfix --- advtrains/textrender.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/advtrains/textrender.lua b/advtrains/textrender.lua index acba0d8..2f8f18b 100644 --- a/advtrains/textrender.lua +++ b/advtrains/textrender.lua @@ -199,7 +199,7 @@ local function split_into_segments(cs) if not sl[1] then sl[1] = {width = cwidth, seq = {char}, size = {cwidth}} else - seg = sl[#sl] + local seg = sl[#sl] local seq, size = seg.seq, seg.size seq[#seq+1] = char size[#size+1] = (size[#size] or 0) + cwidth @@ -330,7 +330,7 @@ local function check_options(width, height, options) -- check "wrap overflow text segment" option ret.wrap_overflow = opt.wrap_overflow and true or false -- convert to boolean -- check line count option - local maxlines = math.max(h/18) + local maxlines = math.floor(h/18) ret.lines = math.min(maxlines, tonumber(opt.lines) or maxlines) -- check text color option ret.color = string.match(tostring(options.color) or "", "^#%x%x%x%x%x%x$") or "#000000" -- cgit v1.2.3