lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



If the Lua process does not run to its end, this can also be caused by buffering. stderr is flushed at each output whereas stdout is normally buffered.

You can change Lua stdout buffering mode by

   io.stdout:setvbuf "no"

http://www.lua.org/manual/5.1/manual.html#pdf-file:setvbuf

-asko


V S P kirjoitti 26.10.2008 kello 9:55:

I am using PHP's proc_open

and can receive with no problem output
of Lua's print commands


(using lua 5.1.4 on Windows for now)

So I am thinking you are doing something wrong
on the MFC side



On Sun, 26 Oct 2008 09:34:54 +0200, "Dennis Povshedny" <dp@xeepe.com>
said:
Hello Andy.Tao,

Hi Andy!

Not answering your question, but just a hint: probably you can
consider usage of io.write() instead of print?

Regards, Dennis

Hi gus,

I have meet a trouble, does anyone could help me?

I embeded lua in my MFC program, and create pipe to receive lua
stdout text, it can receive error message but print, why? code
context is:

1. Create Pipe: CreatePipe(&PipeRead, &PipeWrite, NULL, 0)

2. Assign pipe write handle to stdout and stderr:

_dup2(_open_osfhandle(PipeRead, _O_TEXT), 1)

_dup2(_open_osfhandle(PipeRead, _O_TEXT), 2)

3. Create thread to read pipe read handle

4. Execute lua code which contain statement: print and error

5. It can receive statement(error) message but print

thanks in advanced!

------------------

Andy Tao[&#38518;&#31062;&#27946;]

&#31062;&#27946;&#27979;&#35797;&#33258;&#21160;&#21270; [1]http://www.zuhong.cn

&#22825 ;&#26159 ;&#22278 ;&#30340 ;&#65292 ;&#22320 ;&#26159 ;&#26041 ;&#30340 ;&#65292 ;&#20961 ;&#20107;&#37117;&#35201;&#26377;&#20010;&#35268;&#30697;&#65281;

--

Best regards,

Dennis                            [2]mailto:dp@xeepe.com

References

1. http://www.zuhong.cn/
2. mailto:dp@xeepe.com
--
 V S P
 toreason@fastmail.fm

--
http://www.fastmail.fm - Same, same, but different...