From 530796bf5f49a783a12c333e7a9e6d9e76b1f2d6 Mon Sep 17 00:00:00 2001 From: Jane Roxanne Date: Sun, 17 May 2020 18:55:09 -0500 Subject: [PATCH] I dunno what this does. --- mods/util_luaconsole/tty.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mods/util_luaconsole/tty.lua b/mods/util_luaconsole/tty.lua index 9ff023b..89b933a 100644 --- a/mods/util_luaconsole/tty.lua +++ b/mods/util_luaconsole/tty.lua @@ -18,9 +18,9 @@ do if (depth == 4) then --pregen color for i=0, 15 do local hi = i >> 3 - local b = (i >> 2) & 1 + local r = (i >> 2) & 1 local g = (i >> 1) & 1 - local r = i & 1 + local b = i & 1 local fr = (r * 0x7F) | (hi << 7) local fg = (g * 0x7F) | (hi << 7) local fb = (b * 0x7F) | (hi << 7) @@ -29,6 +29,7 @@ do end function colors(i) + if (i < 0) then i = 0 elseif (i > 15) then i = 15 end if (depth == 1) then return ((i > 0) and 0xFFFFFF) or 0 elseif (depth == 4) then