colony monitor output

This commit is contained in:
Buduf 2022-06-30 11:05:14 +02:00
parent a008309155
commit b316ced862
2 changed files with 25 additions and 0 deletions

11
monitor.lua Normal file
View File

@ -0,0 +1,11 @@
require("printTable")
local monitors = { peripheral.find("monitor") }
for key, monitor in pairs(monitors) do
monitor.setTextScale(0.5)
monitor.clear()
monitor.setCursorPos(1, 1)
--monitor.write("Hello World!")
end
local wo = colony.getWorkOrders()
local pr = textutils.serialise(wo)
printTable(wo, 0)

14
printTable.lua Normal file
View File

@ -0,0 +1,14 @@
local function _printTable(table, s, tabs)
for key, value in pairs(table) do
if type(value) == "table" then
_printTable(table, "", tabs + 1)
else
print(string.rep(' ', tabs), key, value)
end
end
return s
end
function printTable(table)
return _printTable(table, "", 0)
end