srlua: print statements not working

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

srlua: print statements not working

aryajur
Hello,
          I compiled srlua on a windows system. I used glue.exe to append a test lua file containing just 2 print statements:

print("Line 1")
print("Last Line") 

But when I run the output executable is displayed on the command line. Also io.read does not work to get input from the user.

Other than input/output the lua script is being executed fine.For example in the following code:

print("Line 1")
f = io.open("testfile.txt","w+")
f:write("Test done"..(nil or "hello")..tostring(53*24))
f:close()
print("Last Line") 

The file is created fine but there is nothing displayed on the command line. What am I doing wrong here to redirect the input/output appropriately?

Thanks,
Milind
Reply | Threaded
Open this post in threaded view
|

Re: srlua: print statements not working

Luiz Henrique de Figueiredo
>           I compiled srlua on a windows system. I used glue.exe to append a
> test lua file containing just 2 print statements:
>
> print("Line 1")
> print("Last Line")
>
> But when I run the output executable is displayed on the command line. Also
> io.read does not work to get input from the user.

Are you running the glued program in the command line or by double clicking
on the .exe?

That's the only thing I can think of. Other people more knowledgeable on
Windows may have other ideas.

Reply | Threaded
Open this post in threaded view
|

Re: srlua: print statements not working

aryajur

Are you running the glued program in the command line or by double clicking
on the .exe?

That's the only thing I can think of. Other people more knowledgeable on
Windows may have other ideas.

Thank you for the response. I tried it both ways it behaves the same way.
Reply | Threaded
Open this post in threaded view
|

Re: srlua: print statements not working

Ignacio Burgueño-2
In reply to this post by Luiz Henrique de Figueiredo
I would check if the executable has been built with console support. (ie, you need to pass /SUBSYSTEM:CONSOLE to the linker when compiling).


Reply | Threaded
Open this post in threaded view
|

Re: srlua: print statements not working

aryajur
In reply to this post by aryajur
It was a problem with compiling srlua. I was compiling it as a windows GUI application (linking with -mwindows option) since I had used it for some GUI applications in the past. After removing that option it works fine as a console application.

Milind

On Tue, Jan 31, 2017 at 10:31 AM, Milind Gupta <[hidden email]> wrote:

Are you running the glued program in the command line or by double clicking
on the .exe?

That's the only thing I can think of. Other people more knowledgeable on
Windows may have other ideas.

Thank you for the response. I tried it both ways it behaves the same way.