-----Original Message-----
From: owner-lua-l@tecgraf.puc-rio.br
[mailto:owner-lua-l@tecgraf.puc-rio.br]On Behalf Of J. Perkins
Sent: Thursday, September 06, 2001 23:34
To: Multiple recipients of list
Subject: Catch get/set of userdata in table?
Is there a way to catch a get/set to a userdata object that is stored in
a table? I know how to do it for a global variable, like LHF showed a
while back (see example below) -- is there some way to do an equivalent
operation on a table member?
(snip)
You could always check if it's a userdata of a type you want to
handle by yourself and in every other case, call the rawset/rawget
methods - in this case you could use the tables as usual and you
only need the special handling for your userdata.
That's the way i do it in a first implementation.
I think somtimes later i may optimize this by adding another type of
tag method, something like "setuserdata"/"getuserdata". After a
very quick look at the sources of Lua it seems easy to implement.
I think for tables, you could insert the required code in
void luaV_settable (lua_State *L, StkId t, StkId key)
I haven't done any tests right now, but i let you know when i've
done the changes (don't have the time right now).
Regards,
Michael Flad
--
Fantastic Realms Interactive GmbH
Birnenweg 15 - D-72766 Reutlingen
Germany