summaryrefslogtreecommitdiff
path: root/shop2
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2023-01-07 05:27:20 +0000
committerubq323 <ubq323@ubq323.website>2023-01-07 05:27:20 +0000
commitdfbcd362bbd9c9e210dc72c9cf451d3f844118c0 (patch)
treed38a53e692e944483645eead7ff70d5399d5e837 /shop2
parent9decfea1b6aefabe7a8efaee2cb0b1e8ea152024 (diff)
shop2
Diffstat (limited to 'shop2')
-rw-r--r--shop2/disp.lua9
1 files changed, 4 insertions, 5 deletions
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)