From c0b41a20dc73f70d0fd4f9b41a45015a17633908 Mon Sep 17 00:00:00 2001 From: ubq323 Date: Thu, 4 Aug 2022 02:40:51 +0100 Subject: chat --- chat.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/chat.lua b/chat.lua index 9e02b1e..b7ce9e3 100644 --- a/chat.lua +++ b/chat.lua @@ -28,6 +28,12 @@ local function pad_r(s,width) return string.rep(" ",width-#tostring(s))..s end +local function pad_c(s,width) + local space = width-#tostring(s) + local hspace = math.floor(space/2) + return string.rep(" ",hspace)..s +end + -- drawing -- lb @@ -36,6 +42,11 @@ local function draw_lb(W,scores) W.setBackgroundColor(colors.gray) W.clear() + -- header + W.setTextColor(colors.lime) + W.setCursorPos(1,1) + W.write(pad_c("==[[ LEADERBOARD ]]==",lbw)) + -- line numbers W.setTextColor(colors.yellow) for line=1,10 do -- cgit v1.2.3