From dfbcd362bbd9c9e210dc72c9cf451d3f844118c0 Mon Sep 17 00:00:00 2001 From: ubq323 Date: Sat, 7 Jan 2023 05:27:20 +0000 Subject: shop2 --- shop2/disp.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'shop2') diff --git a/shop2/disp.lua b/shop2/disp.lua index 43777ac..46270a2 100644 --- a/shop2/disp.lua +++ b/shop2/disp.lua @@ -3,7 +3,6 @@ local stock=require"shop2.stock" local function printseq(m) return function(q) for _,v in ipairs(q) do - print(type(v),v) if type(v) == "number" then m.setTextColor(v) elseif type(v) == "string" then @@ -36,8 +35,6 @@ local function disp_shopscreen(items) -- i don't like how hardcoded all the spacing is in this -- but i also don't feel like rewriting it yet. local mon = peripheral.find"monitor" - mon.clear() - mon.setTextScale(0.5) local si = stock.take_stock() @@ -47,8 +44,7 @@ local function disp_shopscreen(items) -- 0 1 2 3 4 5 -- local function fmt_row(m,y, stock,price,adr,name, colour) - local function fmt_row(y, idesc, colour) - local amt = stock.amt_of(si,idesc) + local function fmt_row(y, idesc, amt, colour) colour = colour or colors.cyan printseq(mon) { {1,y}, colors.white, pad(amt,5), @@ -68,6 +64,9 @@ local function disp_shopscreen(items) local adrs = {} for adr in pairs(items) do table.insert(adrs,adr) end table.sort(adrs) + + mon.clear() + mon.setTextScale(0.5) for ix,adr in ipairs(adrs) do local idesc = items[adr] fmt_row(ix+2, idesc) -- cgit v1.2.3