Use work order for inspection

This commit is contained in:
Ben 2024-06-04 01:07:50 +02:00
parent 08122f1f7e
commit a645d7b310
Signed by: ben
GPG key ID: 1353F41CF1CFF2D3

View file

@ -1,3 +1,4 @@
local config = require "config"
local winhlp = require "winhlp"
local function drawLine(termlike, pair)
@ -11,23 +12,31 @@ local function drawLine(termlike, pair)
termlike.write(string.format("%" .. padding+1 .. "s", " "))
termlike.write(value)
end
local listview = (require "listview"):new{drawEntry=drawLine}
local keys = {[1]="a", [2]="c"}
local obj = {a="b", c="d"}
local function setTerm(termlike)
listview.frame = termlike
end
local function setObject(other)
obj = other
keys = {}
local function prepareObject(other)
local keys = {}
for key, _ in other do
keys.insert(key)
end
table.sort(keys)
return other, keys
end
local obj = {}
local keys = {}
local colony = peripheral.wrap(config.colony_interface_side)
if colony.isInColony() then
obj, keys = prepareObject{colony.getWorkOrders()[1]}
end
local function setObject(other)
obj, keys = prepareObject{other}
end
local function fetch(wait_for)