Ask coding questions

← Back to all posts
Print without newline in lua?
GabeEE (6)

I'm trying to make a function that prints a specified line without creating a newline every time. io.write hasn't been working(nothing is written until for loop finishes) and I'm a bit stumped- little help here?

Answered by Coder100 (18101) [earned 5 cycles]
View Answer
Comments
hotnewtop
Coder100 (18101)

don't forget to also flush

io.write('hai')
io.flush()

reason: because all text is buffered from the terminal, nothing will print until a newline occurs.