Posted 12 January 2015 - 10:45 PM
Silly question
With this code:
When i hit a key, it's written after the "->", so everytime i hit a wrong number and hit for example A,B, whatever to continue , i have to erase that char cause, even though i print some stuff after that, the char is written on the screen
Like this:
[namedspoiler:Hit wrong number:]
[attachment=2048:CC1.png]
[namedspoiler:Hit 'a' once:]
[attachment=2050:cc2.png]
With this code:
function main()
local ch
while ch ~= "9" do
term.clear()
term.setCursorPos(1,1)
print(" ## -- - OPTIONS - -- ## ")
print(" 1 - Option 1")
print(" 2 - Option 2")
print(" 9 - Exit")
write(" -> ")
ch = read()
if(ch == "1") then
--option1()
elseif(ch == "2") then
--option2()
elseif(ch == "9") then
print("Bye Bye")
else
print("WRONG OPTION")
write("Press any key to continue...")
os.pullEvent("key")
end
end
end
main()
When i hit a key, it's written after the "->", so everytime i hit a wrong number and hit for example A,B, whatever to continue , i have to erase that char cause, even though i print some stuff after that, the char is written on the screen
Like this:
[namedspoiler:Hit wrong number:]
[attachment=2048:CC1.png]
[namedspoiler:Hit 'a' once:]
[attachment=2050:cc2.png]
Edited on 12 January 2015 - 10:54 PM