From 045abbd6d7bac8d4706731cb36c1c15dd98fdf13 Mon Sep 17 00:00:00 2001 From: Coder12a <32314020+Coder12a@users.noreply.github.com> Date: Sun, 15 Oct 2017 19:09:26 -0700 Subject: [PATCH] Books: Convert \r to \n Some files or editors may use \r instand of \n like notepad++. If you copy text written in notepad++ and pasted into the book. The book will only have one page. --- mods/default/craftitems.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/mods/default/craftitems.lua b/mods/default/craftitems.lua index e4a93ae5..e1d224d1 100644 --- a/mods/default/craftitems.lua +++ b/mods/default/craftitems.lua @@ -112,6 +112,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) end data.description = "\""..short_title.."\" by "..data.owner data.text = fields.text:sub(1, max_text_size) + data.text = data.text:gsub("\r\n", "\n"):gsub("\r", "\n") data.page = 1 data.page_max = math.ceil((#data.text:gsub("[^\n]", "") + 1) / lpp)