lua-users home
lua-l archive

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


On Tue, 1 Mar 2011, Sylvain Fabre wrote:
> Le 01/03/2011 12:30, Tony Finch a écrit :
> >
> > Change the contents of the userdata itself so that it is no longer a valid
> > instance of its original type.
>
> Sorry to come back on that, but how to do that in a C function (ie the
> send_message function, typically) ?
> I do not see how i can remove the variable from the C api.

You can only do it if you know the details of the particular object you
are dealling with. You can't do it in a generic way independent of what
is inside the userdata. But you need to know what's inside the userdata
to reconstruct it in the destination Lua state, so this restriction
should not be a problem.

It might be as simple as zeroing out the userdata and removing its
metatable.

Tony.
-- 
f.anthony.n.finch  <dot@dotat.at>  http://dotat.at/
Fisher: Variable 3 or 4, becoming southwesterly 4 or 5 in north. Mainly
slight. Fair. Moderate or good.