ComputerCraft Forums

ComputerCraft => Ask a Pro => Topic started by: CreeperGoBoom on Dec 18, 2019, 03:44 AM

Title: How to write in a deletable answer for io.read
Post by: CreeperGoBoom on Dec 18, 2019, 03:44 AM
I want my program to prompt me but then allow me to change the answer it wrote in.
current code snippet:
function getUserInputWithDefault(stringPrompt,stringDefault) 
  print(stringPrompt)
  io.write(stringDefault)
  local result = io.read()
  return result
end

getUserInputWithDefault("Test prompt","deleteable answer")

Is this possible?
Title: How to write in a deletable answer for io.read
Post by: Lupus590 on Dec 18, 2019, 08:49 AM
Read doesn't have this functionality, you will have to implement your own read.

You can find read in the BIOS and use it as a basis of your readWithDefault

Are you still on 1.7.10 or are you on 1.12.2 with CC:T?