Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- hasMon = false;
- list = {}
- i = 0;
- len = 0;
- if peripheral.isPresent("top") then
- hasMon = true;
- mon = peripheral.wrap("top");
- print("Monitor was found!");
- mon.clear();
- end
- function nl()
- if hasMon == true then
- local x,y = mon.getCursorPos();
- mon.setCursorPos(1, y+1);
- end
- end
- function printm(str)
- if type(str) ~= "string" then return end
- print(str);
- mon.write(str);
- nl();
- end
- function add()
- printm("\n Please enter the task");
- listAns = read();
- if type(listAns) == "string" then
- i = i +1;
- len = len +1;
- list[i] = i .. " - " .. listAns;
- printm(list[i]);
- end
- end
- function remove()
- print("removing");
- end
- function start()
- while true do
- print("What would you like to do?");
- print(" - Type \"add\" to add an item");
- print(" - Type \"remove\" to add an item");
- print(" - Type \"quit\" to save and quit");
- ans = read();
- if type(ans) == "string" then
- if ans == "add" then add() end
- if ans == "remove" then remove() end
- if ans == "quit" then
- printm("Goodbye!");
- os.shutdown();
- end
- end
- end
- end
- start();
Advertisement
Add Comment
Please, Sign In to add comment