View difference between Paste ID: FwiUVNv4 and D4B0S6Dz
SHOW: | | - or go back to the newest paste.
1
hasMon = false;
2
list = {}
3
i = 0;
4
len = 0;
5
if peripheral.isPresent("top") then
6
	hasMon = true;
7
	mon = peripheral.wrap("top");
8
	print("Monitor was found!");
9
	mon.clear();
10
end
11
12
function nl()
13
	if hasMon then
14
	local x,y = mon.getCursorPos();
15
	mon.setCursorPos(0, y+1);
16-
	printm("adding");
16+
17
18
function printm(str)
19
	if type(str) ~= "string" then return end
20
	print(str);
21
	mon.write(str);
22
	nl();
23
end
24
25
function add()
26
	printm("\n Please enter the task");
27
	listAns = read();
28
	if type(listAns) == "string" then
29
		i = i +1;
30
		len = len +1;
31
		list[i] = i .. " - " .. listAns;
32
	end
33
end
34
35
function remove()
36
	printm("removing");
37
end
38
39
function start()
40
	while true do
41
		printm("What would you like to do?");
42
		printm(" - Type \"add\" to add an item");
43
		printm(" - Type \"remove\" to add an item");
44
		printm(" - Type \"quit\" to save and quit");
45
		ans = read();
46
		if type(ans) == "string" then
47
			if ans == "add" then add() end
48
			if ans == "remove" then remove() end
49
			if ans == "quit" then 
50
				printm("Goodbye!");
51
				os.shutdown();
52
			end
53
		end
54
	end
55
end
56
57
start();