From c08eb3452f328b30cf7bb215aaba9629de0f7737 Mon Sep 17 00:00:00 2001 From: OgelGames Date: Sat, 5 Jun 2021 17:06:08 +1000 Subject: [PATCH] allow writing `#` on signs --- README.md | 2 +- api.lua | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7f8bb0a..97c0062 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ That said, there are some basic text formatting options: Writing "^" followed by a letter "a" through "h" will produce double-wide versions of these arrows, in the same order. These wide arrows occupy 0x89 to 0x91 in the character set. -* A color may be specified in the sign text by using "#" followed by a single hexadcimal digit (0-9 or a-f). These colors come from the standard Linux/IRC/CGA color set, and are shown in the sign's formspec. Any color change will remain in effect until changed again, or until the next line break. Any number of color changes in any arbitrary arrangement is allowed. +* A color may be specified in the sign text by using "#" followed by a single hexadcimal digit (0-9 or a-f). These colors come from the standard Linux/IRC/CGA color set, and are shown in the sign's formspec. Any color change will remain in effect until changed again, or until the next line break. Any number of color changes in any arbitrary arrangement is allowed. To write "#" on a sign, write "##". * Most writable signs can display double-wide text by flipping a switch in the sign's formspec. diff --git a/api.lua b/api.lua index 6ec8a86..b814e75 100644 --- a/api.lua +++ b/api.lua @@ -555,8 +555,9 @@ local function make_line_texture(line, lineno, pos, line_width, line_height, cwi end end local c = word:sub(i, i) - if c == "#" then - local cc = tonumber(word:sub(i+1, i+1), 16) + local c2 = word:sub(i+1, i+1) + if c == "#" and c2 ~= "#" then + local cc = tonumber(c2, 16) if cc then i = i + 1 cur_color = cc