LuaCom 1.3: Passing wstrings Around, Running a Message Loop?

Hi, Two newbie Qs on LuaCom 1.3:

1. Can you pass the LuaPlus unicode wstring type to and from COM apps? 
Reading the LuaCom docs it seems to me that unicode strings always get 
downgraded to ANSI, though I haven't tried any strings where it would matter 
just yet.

2. How do you synchronously leave an event loop running and get all the 
events to be either processed in some handler function or called by name in 
a table? In Perl's Win32::OLE I can do:

Win32::OLE->WithEvents($app, $handler);

And I get the $app and methodname as arguments, I think.

Then later, I just say:

Win32::OLE->MessageLoop;

I found a thread that vaguely hints at a StartMessageLoop function in 
LuaCom, but I did not see it documented and did not fully understand from 
the description how to use it. So anye samples of how, say, a stand-alone 
console app can receive events, would be cool. My test app in Perl can do 
that, happily printing the names of event methods it gets called with, 
though I reckon it has to use a separate invisible window for the message 
loop anyway.

--

-- 
With kind regards Veli-Pekka Tätilä
Accessibility, Apps and Coding plus Synths and Music:
(Continue reading)

Matt Campbell | 6 Sep 17:05
Favicon

Re: LuaCom 1.3: Passing wstrings Around, Running a Message Loop?

I don't know how LuaCOM handles Unicode when used with LuaPlus, but with 
regular Lua, LuaCOM returns strings as UTF-8 and expects incoming 
strings to be in UTF-8.  This has been the case for years.  So if 
LuaPlus has functions to convert between wstrings and UTF-8, you should 
use these.

To run a message loop, use the StartMessageLoop function in the LuaCOM 
module.

Matt

Re: LuaCom 1.3: Passing wstrings Around, Running a Message Loop?

Matt Campbell wrote:
> I don't know how LuaCOM handles Unicode when used with LuaPlus, but with
> regular Lua, LuaCOM returns strings as UTF-8 and expects incoming
> strings to be in UTF-8.
I sure didn't know that. I've browsed most of the docs but seems this bit 
escaped me somehow. Well, thanks for letting me know.

> To run a message loop, use the StartMessageLoop function in the LuaCOM 
> module.
Where did you discover this function? The reason I ask is, I'm beginning to 
suspect I'm reading the wrong doc or an old version of it. The one I have 
(converted to plain text) mentions neither UTF-8 nor the message loop 
functions you did, though granted unicode and message loops are touched upon 
in a couple of passages. I've regexp searched through it and read most of 
it, on a need to know basis. Here you are:

http://www.tecgraf.puc-rio.br/~rcerq/luacom/pub/1.3/luacom-htmldoc/

Thanks for the quick post at any rate.

--

-- 
With kind regards Veli-Pekka Tätilä
Accessibility, Apps and Coding plus Synths and Music:
http://vtatila.kapsi.fi

Matt Campbell | 6 Sep 20:07
Favicon

Re: LuaCom 1.3: Passing wstrings Around, Running a Message Loop?

I've read some of the source code of LuaCOM, because I use it quite a 
bit in my own work.  I researched the subject of LuaCOM's Unicode 
support nearly four years ago.  I don't remember how I discovered that 
LuaCOM has a function to run a message loop, but I remembered today that 
it does, so I searched the main module for "GetMessage" to find out 
which LuaCOM function does that.

Anyway, I guess these things are undocumented.

Matt


Gmane