[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: LuaJava: table iterator for jav objects
- From: Christian Vogler <cvogler@...>
- Date: Mon, 25 Nov 2002 07:27:56 -0500
On Mon, Nov 25, 2002 at 12:46:28PM +0100, Andreas Rozek wrote:
> - is there a good description of LuaJava (I read both the
> TechReport by Carlos Cassino (in english) as well as the
> web pages and the ReadMe bundled with the distribution)
> or even s.th. like a "Programmers Guide" etc.?
unfortunately, there does not seem to be any other documentation
available. I could provide some examples from my own application, if
you think that they would help.
> - I tried a "for Key,Value in ..." on several Java objects
> - Java data fields will never show up in that list
> - Java methods will only show up if they have been expli-
> citly accessed before
Yes, that is the intended behavior. The lua tables cache the
references to the Java methods, because obtaining them with the Java
reflection API is a fairly expensive operation. As far as I can see,
this is the only reason why these tables are there in the first
You could probably write some code (in Lua, even!) that obtains the
full list of methods and puts them in the table. The question is how
much it would slow down the creation of and access to Java objects.
> - even then, I sometimes get a "LuaException" (e.g., if
> I try to examine a jawa.AWT.Frame object)
I have never seen anything like that, unless there was some kind of
programmer error. Could you please be more specific?
P.S. I have not forgotten about your other message re hash tables. I
need a little time to think it over, and to compose my reply with a
detailed explnation, because the whole situation is actually pretty