Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArgs = { ... }
- if #tArgs ~= 1 then
- printError("Usage: "..shell.getRunningProgram().." <tdl file>")
- end
- local todolist = tArgs[1]
- local f = fs.open(todolist,"r")
- local tdl = textutils.unserialize(f.readAll())
- f.close()
- if not tdl then error("TDL file is empty!") end
- local bn = 0
- local function convert(num)
- return tostring(math.floor(num*100))
- end
- local function pad(num)
- local str = convert(num)
- local ret = ""
- local len = str:len()
- ret = string.rep(" ",3-len) .. str
- return ret
- end
- term.clear()
- term.setCursorPos(1,1)
- print("TDLViewer 0.2")
- print("-------------")
- for _,i in pairs(tdl) do
- if type(i[2]) == "number" then
- local str = pad(i[2])
- print(str .. " " .. i[1])
- else
- print(" - "..i[1])
- for _,t in pairs(i[2]) do
- local str = pad(t[2])
- print("|"..str.." "..t[1])
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment