View difference between Paste ID: 20u5LdBA and LxMNGsPj
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 == true then
14
	local x,y = mon.getCursorPos();
15-
	mon.setCursorPos(0, y+1);
15+
	mon.setCursorPos(1, y+1);
16
	end
17
end
18
19
function printm(str)
20
	if type(str) ~= "string" then return end
21
	print(str);
22
	mon.write(str);
23
	nl();
24
end
25
26
function add()
27
	printm("\n Please enter the task");
28
	listAns = read();
29
	if type(listAns) == "string" then
30
		i = i +1;
31
		len = len +1;
32
		list[i] = i .. " - " .. listAns;
33
		printm(list[i]);
34
	end
35
end
36
37-
	printm("removing");
37+
38
	print("removing");
39
end
40
41
function start()
42-
		printm("What would you like to do?");
42+
43-
		printm(" - Type \"add\" to add an item");
43+
		print("What would you like to do?");
44-
		printm(" - Type \"remove\" to add an item");
44+
		print(" - Type \"add\" to add an item");
45-
		printm(" - Type \"quit\" to save and quit");
45+
		print(" - Type \"remove\" to add an item");
46
		print(" - Type \"quit\" to save and quit");
47
		ans = read();
48
		if type(ans) == "string" then
49
			if ans == "add" then add() end
50
			if ans == "remove" then remove() end
51
			if ans == "quit" then 
52
				printm("Goodbye!");
53
				os.shutdown();
54
			end
55
		end
56
	end
57
end
58
59
start();