From 96f5a4351db8c9650cd3406de3f066f2847f0a73 Mon Sep 17 00:00:00 2001 From: ubq323 Date: Mon, 2 Jan 2023 02:46:41 +0000 Subject: shop --- shop2.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/shop2.lua b/shop2.lua index 40e0e59..aeb1b66 100644 --- a/shop2.lua +++ b/shop2.lua @@ -30,6 +30,11 @@ local function pad(s,n) local p = string.rep(" ",math.max(0,n-l)) return p..s end +local function centre(s,w) + s=tostring(s) + local l = #s + local p = math.floor(math.max(0,w-l)/2)) + return string.rep(" ",p)..s local function disp_shopscreen() local m = peripheral.wrap"left" @@ -59,6 +64,12 @@ local function disp_shopscreen() fmt_row(m,ix+2,i[5],i[2],i[1],i[4]) end + local w,h = m.getSize() + + printseq(m) { + {1,h-1}, colors.blue, centre("/pay @ac.kst ",w) + } + end -- cgit v1.2.3