Posted 04 April 2015 - 07:10 PM
When I use event "key" that button what I pressed automatically writing in field of read. How to fix it?
function presets(atStart)
repeat
clr(colors.lightBlue)
centerText("x","Run OS at start?",(YSize/2)-2,colors.white)
centerText("xy","(Y/N)",nil,colors.white)
local event, key = os.pullEvent("key")
if key == keys.y then
atStart = true
elseif key == keys.n then
atStart = false
end
until (key == keys.y) or (key == keys.n)
clr(colors.lightBlue)
centerText("x","Enter computer name:",(YSize/2)-2,colors.white)
term.setCursorPos(5,YSize/2)
os.setComputerLabel(read())
installingAll(atStart)
end
When I use event "key" that button what I pressed automatically writing in field of read. How to fix it?
os.startTimer(0.1) --# If there weren't any stray char events, this will make sure the code doesn't freeze up
os.pullEvent()
Thank you! You helps me :)/>You need to catch any stray 'char' events