colony monitor
This commit is contained in:
parent
df308cf365
commit
128798cf22
@ -4,8 +4,7 @@ for key, monitor in pairs(monitors) do
|
|||||||
monitor.setTextScale(0.5)
|
monitor.setTextScale(0.5)
|
||||||
monitor.clear()
|
monitor.clear()
|
||||||
monitor.setCursorPos(1, 1)
|
monitor.setCursorPos(1, 1)
|
||||||
--monitor.write("Hello World!")
|
|
||||||
end
|
end
|
||||||
local wo = colony.getWorkOrders()
|
local wo = colony.getWorkOrders()
|
||||||
local pr = textutils.serialise(wo)
|
local s = printTable(wo)
|
||||||
printTable(wo, 0)
|
monitors[1].write(s)
|
||||||
|
|||||||
@ -1,14 +1,16 @@
|
|||||||
local function _printTable(table, s, tabs)
|
local result = ""
|
||||||
|
|
||||||
|
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
|
||||||
print(string.rep(' ', tabs), key, value)
|
result = result .. "\n" .. string.rep(" ", tabs) .. key .. ": " .. value
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return s
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function printTable(table)
|
function printTable(table)
|
||||||
return _printTable(table, "", 0)
|
_printTable(table, 0)
|
||||||
|
return result
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user