Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Koneki » io.read waits before any print() output?
io.read waits before any print() output? [message #1416796] Wed, 13 February 2013 19:29 Go to next message
Eclipse UserFriend
I am trying to run my script in the editor which has code something like this:


print('Enter your Name:')
io.read('*line')


When I run it does not print out 'Enter your Name' until after I type something in the console and hit enter. This kind of defeats the point of having a prompt. This applies to all print() functions that I have in code before or after the io.read(). Nothing gets printed until all of the io.read() commands have received input, then everything comes out afterward.

I have run the same code in a different editor (Zerobrane) and it works as I would expect (i.e. prints the prompt then waits for input).

Any suggestions?
Re: io.read waits before any print() output? [message #1416797 is a reply to message #1416796] Fri, 15 February 2013 15:57 Go to previous messageGo to next message
Marc Aubry is currently offline Marc AubryFriend
Messages: 76
Registered: July 2009
Member
Hi Kevin,

First, thanks to take time for feedback.

To work as you expect, the sdtout buffer have to be configured by adding the following line at the top of your file:
io.stdout:setvbuf('no')

As explain in the documentation here: http://wiki.eclipse.org/Koneki/LDT/Developer_Area/User_Guides/User_Guide_0.9#Local_Interpreters (buffer configuration part). You can also execute this line at each launch of your interpreter by adding the option -e "io.stdout:setvbuf('no')" to your interpreter in the configure interpreter preference page.

As other users may have the same expectation as you about the console behavior, I have also open this bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=400938 to set this interpreter argument option by default for JNLua interpreters.

Marc
Re: io.read waits before any print() output? [message #1416798 is a reply to message #1416797] Fri, 15 February 2013 17:02 Go to previous message
Eclipse UserFriend
Thank you. Fixed the problem perfectly. I figured there was something I missed in the setup.

Kevin
Previous Topic:How to remote debug
Next Topic:LDT doesn't show up (ubuntu)
Goto Forum:
  


Current Time: Fri Nov 01 00:18:03 GMT 2024

Powered by FUDForum. Page generated in 0.05213 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top