SHOW:
|
|
- or go back to the newest paste.
| 1 | hasMon = false; | |
| 2 | if peripheral.isPresent("top") then
| |
| 3 | hasMon = true; | |
| 4 | mon = peripheral.wrap("top");
| |
| 5 | print("Monitor was found!");
| |
| 6 | mon.clear(); | |
| 7 | end | |
| 8 | ||
| 9 | function printm(str) | |
| 10 | if type(str) ~= "string" then return end | |
| 11 | print(str); | |
| 12 | mon.write(str); | |
| 13 | end | |
| 14 | ||
| 15 | function add() | |
| 16 | printm("adding");
| |
| 17 | end | |
| 18 | function remove() | |
| 19 | printm("removing");
| |
| 20 | end | |
| 21 | ||
| 22 | function start() | |
| 23 | while true do | |
| 24 | printm("What would you like to do?");
| |
| 25 | printm(" - Type \"add\" to add an item");
| |
| 26 | printm(" - Type \"remove\" to add an item");
| |
| 27 | printm(" - Type \"quit\" to save and quit");
| |
| 28 | ans = read(); | |
| 29 | if type(ans) == "string" then | |
| 30 | - | if ans = "add" then add(); |
| 30 | + | if ans == "add" then add(); |
| 31 | - | if ans = "remove" then remove(); |
| 31 | + | if ans == "remove" then remove(); |
| 32 | - | if ans = "quit" then |
| 32 | + | if ans == "quit" then |
| 33 | printm("Goodbye!");
| |
| 34 | os.shutdown(); | |
| 35 | end | |
| 36 | end | |
| 37 | end | |
| 38 | end | |
| 39 | ||
| 40 | start(); |