Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Signal Database to table test, making sure it worooks.
- --Okay, first step, get that freaking signaldatabase
- local function loadTableFile(path) -- Quiciker way to do things w o a h
- local handle = fs.open(path, "r")
- local thing = textutils.unserialise(handle.readAll())
- handle.close()
- return thing
- end
- local signalDatabase = loadTableFile("signalDatabase")
- --W..we got it? Good. That's good!
- function sorted_iter(t)
- local i = {}
- for k in next, t do
- table.insert(i, k)
- end
- table.sort(i)
- return function()
- local k = table.remove(i)
- if k ~= nil then
- return k, t[k]
- end
- end
- end
- for s, str in sorted_iter(signalDatabase) do
- end
- local function drawScreen()
- term.clear()
- term.setCursorPos(1,1)
- term.write("Table to Display")
- term.setCursorPos(1, 2)
- term.setCursorPos(1,3)
- local previousCoordsX
- local previousCoordsY
- for s, str in ipairs(signalDatabase) do
- print(v)
- local x, y = term.getCursorPos()
- if str.type == "signal" then
- term.setBackgroundColor(colors.black)
- term.setCursorPos(x + 2, y - 1)
- term.write(str.name)
- term.setCursorPos(x, y)
- paintutils.drawLine(x + 1, y, x + 8, y, colors.lime)
- end
- if str.type == "switch" then
- paintutils.drawLine(x + 1, y, x + 3, y + 2, colors.lime)
- -- paintutils.drawLine(x + 1, y, x + 3, y, colors.lime)
- end
- end
- end
- drawScreen()
Advertisement
Add Comment
Please, Sign In to add comment