Advertisement
guitarplayer616

Console

Jun 23rd, 2015
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.80 KB | None | 0 0
  1. printList = {}
  2. local w,h = term.getSize()
  3. for y = 1,h do
  4.     printList[y] = nil
  5. end
  6. local console = window.create(term.native(),w/2,1,w,h/2)
  7. local lines = 0
  8.  
  9. function log(words)
  10.     lines = lines + 1
  11.     printList[lines] = {words,colors.white,colors.black}
  12. end
  13.  
  14. function logError(words)
  15.     lines = lines + 1
  16.     printList[lines] = {words,colors.red,colors.black}
  17. end
  18.  
  19. function display(mod)
  20.     term.clear()
  21.     for i=1 + mod, h + mod do
  22.         if printList[i] then
  23.             term.setCursorPos(1,i)
  24.             term.setTextColor(printList[i][2])
  25.             console.write(printList[i][1])
  26.         end
  27.     end
  28. end
  29.  
  30. log('random')
  31. log('even more randomness')
  32. logError('randomERrRor')
  33.  
  34. for i,v in pairs(printList) do
  35.     print(i,": ",v)
  36.     if type(v) == "table" then
  37.         print("table")
  38.         for i=1,#v do
  39.             print(": ",v[i])
  40.         end
  41.     end
  42. end
  43.  
  44. display(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement