mirror of
https://github.com/minetest-mods/digilines.git
synced 2025-07-07 10:41:59 +02:00
use text verbatim if it fits on the screen
This commit is contained in:
4
lcd.lua
4
lcd.lua
@ -34,6 +34,9 @@ local create_lines = function(text)
|
|||||||
local line = ""
|
local line = ""
|
||||||
local line_num = 1
|
local line_num = 1
|
||||||
local tab = {}
|
local tab = {}
|
||||||
|
if #text <= LINE_LENGTH then
|
||||||
|
line = text
|
||||||
|
else
|
||||||
for word in string.gmatch(text, "%S+") do
|
for word in string.gmatch(text, "%S+") do
|
||||||
if string.len(line)+string.len(word) < LINE_LENGTH and word ~= "|" then
|
if string.len(line)+string.len(word) < LINE_LENGTH and word ~= "|" then
|
||||||
if line ~= "" then
|
if line ~= "" then
|
||||||
@ -54,6 +57,7 @@ local create_lines = function(text)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
table.insert(tab, line)
|
table.insert(tab, line)
|
||||||
return tab
|
return tab
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user