How to write in a deletable answer for io.read

Started by CreeperGoBoom, Dec 18, 2019, 03:44 AM

Previous topic - Next topic

CreeperGoBoom

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?

Lupus590

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?