TwitchBlade

todoList_0.0.3

Sep 11th, 2018
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.55 KB | None | 0 0
  1. c       = require("component")
  2. t       = require("term")
  3. shell   = require("shell")
  4. text    = require("text")
  5.  
  6. todoList = {"Enter anything to add it to the list", "1. Finish TODO List"}
  7.  
  8.  
  9. --functions
  10.  
  11. function getInput()
  12.   userInput = text.trim(t.read())
  13.   if userInput == "exit" then
  14.     os.reboot()
  15.   end
  16.   table.insert(todoList, userInput)
  17. end
  18.  
  19. function updateScreen()
  20.   term.clear()
  21.   for i,v in ipairs(todoList) do
  22.     print(tostring(i) .. ". " .. tostring(v))
  23.   end
  24. end
  25.  
  26. --Main Code Block
  27. while true do
  28.   updateScreen()
  29.   getInput()
  30. end
Advertisement
Add Comment
Please, Sign In to add comment