Use work order for inspection
This commit is contained in:
parent
08122f1f7e
commit
a645d7b310
23
inspect.lua
23
inspect.lua
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue