From: Coder12a <32314020+Coder12a@users.noreply.github.com> Date: Mon, 16 Oct 2017 02:09:26 +0000 (-0700) Subject: Books: Convert \r to \n X-Git-Tag: 0.4.17.1~13 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=7d07c52d0965d8a80ae602ce329bee536dc56478;p=oweals%2Fminetest_game.git 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. --- 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)