Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("ocs/apis/sensor")
- local prox = sensor.wrap("bottom")
- local monitor
- --# Find a monitor
- for _, name in ipairs( peripheral.getNames() ) do
- if peripheral.getType( name ) == "monitor" then
- monitor = peripheral.wrap( name )
- end
- end
- while true do
- --# Get all targets and then insert them into the visitors table
- local targets = prox.getTargets()
- for name, _ in pairs( targets ) do
- local n = {}
- n.name = name
- n.timestamp = textutils.formatTime( os.time() )
- table.insert( visitors, n )
- end
- --# Loop through the visitor table and draw the stuff xP
- monitor.clear()
- for i = 1, #visitors do
- monitor.setCursorPos( 1, i )
- monitor.write( visitors[i].name .. " | " .. visitors[i].timestamp )
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment