[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LuaJava: cannot assign a tag to proxy objects?
- From: Christian Vogler <cvogler@...>
- Date: Mon, 25 Nov 2002 09:08:57 -0500
On Mon, Nov 25, 2002 at 02:56:43PM +0100, Andreas Rozek wrote:
> local Window = javaNewInstance("java.awt.Frame","(Test)");
> Window:show();
>
> local JavaTag = newtag();
> settag(Window,JavaTag);
The proxies already have a user-defined tag. You have two choices:
1. Hook into the existing tag methods, like this:
do
oldmethod = gettagmethod(proxy_tag, "gettable")
settagmethod(proxy_tag, "gettable",
function(table, value)
if this_is_my_responsibility() then
return dosomething(table, value)
else
return %oldmethod(table, value)
end
end)
end
2. Put the proxy in a table of your own, and set the tag for that table.
- Christian