colony monitor
This commit is contained in:
parent
17745c996c
commit
437b8f1a91
@ -6,5 +6,5 @@ for key, monitor in pairs(monitors) do
|
|||||||
monitor.setCursorPos(1, 1)
|
monitor.setCursorPos(1, 1)
|
||||||
end
|
end
|
||||||
local wo = colony.getWorkOrders()
|
local wo = colony.getWorkOrders()
|
||||||
local s = printTable(wo)
|
term.redirect(monitors[1])
|
||||||
monitors[1].write(s)
|
printTable(wo)
|
||||||
|
|||||||
@ -1,16 +1,13 @@
|
|||||||
local result = ""
|
|
||||||
|
|
||||||
local function _printTable(table, tabs)
|
local function _printTable(table, tabs)
|
||||||
for key, value in pairs(table) do
|
for key, value in pairs(table) do
|
||||||
if type(value) == "table" then
|
if type(value) == "table" then
|
||||||
_printTable(value, tabs + 1)
|
_printTable(value, tabs + 1)
|
||||||
else
|
else
|
||||||
result = result .. "\n" .. string.rep(" ", tabs) .. key .. ": " .. value
|
print(string.rep(" ", tabs) .. key .. ": " .. value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function printTable(table)
|
function printTable(table)
|
||||||
_printTable(table, 0)
|
_printTable(table, 0)
|
||||||
return result
|
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user