Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function setUsers()
- local RUNNING = true
- local USERS = {}
- local SIDE = sensors.getController()
- local SENSOR = "Sensor"
- local INFO = sensors.getSensorInfo(SIDE, SENSOR, "probes")
- local MONITOR = peripheral.wrap("back")
- local probe, targets, t, target, d, i, v, y, z
- print(INFO.probes)
- while RUNNING do
- USERS = {}
- for probe in string.gmatch(INFO.probes, "%a+") do
- if probe ~= nil then
- local targets = sensors.getAvailableTargetsforProbe(SIDE, SENSOR, probe);
- for t, target in pairs(targets) do
- local d = sensors.getSensorReadingAsDict(SIDE, SENSOR, target, probe);
- for i, v in pairs(d) do
- if tostring(i) == "name" then
- table.insert(USERS, v)
- end
- end
- end
- end
- end
- term.clear()
- term.setCursorPos(1, 1)
- for i, v in ipairs(USERS) do
- print(USERS[i])
- end
- --MONITOR.clear()
- --MONITOR.setCursorPos(1, 2)
- sleep(1)
- end
- end
- function input()
- local RUNNING = true
- while RUNNING do
- local event, param1 = os.pullEvent("char")
- if param1 == "x" then
- return false
- end
- end
- return false
- end
- parallel.waitForAny(setUsers, input)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement