Maxstripe

compat

May 10th, 2015
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. --
  2. -- Library code used by the example programs
  3. -- Computercraft version
  4. --
  5.  
  6. -- Utility for calling a function and printing the
  7. -- error message if it throws an exception
  8.  
  9. function try(func, ...)
  10. ok, result = pcall(func, ...)
  11. if not ok then
  12. print("Error: " .. result)
  13. end
  14. end
  15.  
  16. -- Terminal API compatibility functions
  17.  
  18. screen_width, screen_height = term.getSize()
  19.  
  20. function setCursor(col, row)
  21. term.setCursorPos(col, row)
  22. end
  23.  
  24. -- Event API compatibility functions
  25.  
  26. function pull_event()
  27. return os.pullEvent()
  28. end
  29.  
  30. key_event_name = "char"
  31.  
  32. function key_event_char(e)
  33. return e[2]
  34. end
Add Comment
Please, Sign In to add comment