aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorywang <yw05@forksworld.de>2021-08-11 00:01:53 +0200
committerywang <yw05@forksworld.de>2021-08-11 00:01:53 +0200
commit0b53745c4d1c04d28939ea5cd93e700474f953a0 (patch)
tree384c9d58c61e2c4bc77874d749032e977d9fbcda
parentcec34c28c9630300eb013ba86a68a0709fe518fc (diff)
downloadadvtrains-trainhud-unifont.tar.gz
advtrains-trainhud-unifont.tar.bz2
advtrains-trainhud-unifont.zip
Minor bugfixtrainhud-unifont
-rw-r--r--advtrains/textrender.lua4
1 files 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"