im trying to read a Sensor from OpenPeripheralAddons. I already could do read something in the lua prompt.
But now i wanted to make a lua program that refresh all 1.5 seconds. But now it cant read the usernames
in the lua shell, i typed in: print(textutils.serialize(p.getPlayerNames()))
and that works.
Now i wanted to print this on a monitor. But now my code dont works and i dont understand why
local radar = peripheral.wrap("top") local x,y = 1,1 local monitor = peripheral.wrap("left") local timer = os.startTimer(1.5) local counter = 0 print("Radarsystem online") while true do local event, param = os.pullEvent("key") if param == "timer" then monitor.clear() counter = table.getn(radar.getPlayerNames()) if counter ~= 0 then for i=0,counter,i+1 do monitor.write(radar.getPlayerNames()[i]) --is doing nothing :/ x,y = monitor.getCursorPos() y = y + 1 monitor.setcursorPos(1,y) end end timer = os.startTimer(1.5) elseif param == 16 then print("closing program...") error("Radar System Closed") end end
i hope you pro's can see my fault
Thanks
gfc