Advertisement
jesusthekiller

Untitled

Jun 6th, 2013
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. read = function(mask, table)
  2. local oread = read
  3. local ret = ""
  4. x, y = term.getCursorPos()
  5. mx, my = term.getSize()
  6.  
  7. local f1 = function()
  8. ret = oread(mask, table)
  9. end
  10.  
  11. local f2 = function()
  12. while true do
  13. local e, d = os.pullEvent("mouse_scroll")
  14.  
  15. if d == 1 then os.queueEvent("key", keys.up) end
  16. if d == -1 then os.queueEvent("key", keys.down) end
  17. end
  18. end
  19.  
  20. local f3 = function()
  21. while true do
  22. local e, k = os.pullEvent()
  23.  
  24. if k == keys.backspace and e == "key" then
  25. x = x - 1
  26. else
  27. x = x + 1
  28. end
  29.  
  30. if x > mx then
  31. x = 1
  32. y = y + 1
  33. term.setCursorPos(1, y)
  34. end
  35. end
  36. end
  37.  
  38. parallel.waitForAny(f1, f2, f3)
  39. return ret
  40. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement