samduuren

..

Jun 18th, 2014
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. os.loadAPI("ocs/apis/sensor")
  2. local prox = sensor.wrap("bottom")
  3.  
  4. local monitor
  5.  
  6. --# Find a monitor
  7. for _, name in ipairs( peripheral.getNames() ) do
  8. if peripheral.getType( name ) == "monitor" then
  9. monitor = peripheral.wrap( name )
  10. end
  11. end
  12.  
  13. while true do
  14. --# Get all targets and then insert them into the visitors table
  15. local targets = prox.getTargets()
  16. for name, _ in pairs( targets ) do
  17. local n = {}
  18. n.name = name
  19. n.timestamp = textutils.formatTime( os.time() )
  20. table.insert( visitors, n )
  21. end
  22.  
  23. --# Loop through the visitor table and draw the stuff xP
  24. monitor.clear()
  25. for i = 1, #visitors do
  26. monitor.setCursorPos( 1, i )
  27. monitor.write( visitors[i].name .. " | " .. visitors[i].timestamp )
  28. end
  29. end
Advertisement
Add Comment
Please, Sign In to add comment