From 6a016ed0b9b097c7e2dda1ecd716cdfaad1ccbb0 Mon Sep 17 00:00:00 2001 From: David Vogel Date: Thu, 28 Jul 2022 11:55:34 +0200 Subject: [PATCH] Handle newline characters in UI messages --- files/ui.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/files/ui.lua b/files/ui.lua index 2776633..c2946e5 100644 --- a/files/ui.lua +++ b/files/ui.lua @@ -85,11 +85,13 @@ function UI:_DrawMessages(messages) else GuiImage(gui, self:_GenID(), 0, 0, "mods/noita-mapcap/files/ui-gfx/hint-16x16.png", 1, 1, 0, 0, 0, "") end - + GuiLayoutBeginVertical(gui, 0, 0, false, 0, 0) if type(message.Lines) == "table" then for _, line in ipairs(message.Lines) do - GuiText(gui, 0, 0, tostring(line)) posY = posY + 11 + for splitLine in tostring(line):gmatch("[^\n]+") do + GuiText(gui, 0, 0, splitLine) posY = posY + 11 + end end end if type(message.Actions) == "table" then