lua-users home
lua-l archive

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


Hi Jonas,

1) print() doesn't work. I can call print() but I don't get any output.
I guess that's because I'm in a Swing application, but I don't see why
it shouldn't work. (I've worked around this by providing my own
JavaFunction.)

Usually print problems related to luajava are due to java stdout
buffering. Try flushing Lua's stdout.
Just a question. You are trying to print to console, right? If you are
trying to print to a swing window, you have to explicitly do that
(there is an example in the test code with the distribution).


2) I want to print the result of each entered line, just as the
interactive mode of lua50.exe, and just as Console in Lua Java works,
but I don't know how to do that. I've looked at the Console
implementation and can't see anything special, is it just due to my
print() not working? Is there a way to get the last value of a
L.LloadBuffer(), L.pcall() cycle?

Yes, it's probably due to your print not working. If pcall returns a
value, it is in the stack. Same as pcall in Lua. You can get the value
using the stack functions.

Cheers,

Thiago