lua-users home
lua-l archive

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


On Tuesday 18 November 2008, Luiz Henrique de Figueiredo wrote:
> > When a statement is closed (either on the C or Lua side), the pointer
> > in its userdata object is nulled.  All Lua wrappers check that it is
> > not null and error out.
>
> I usually remove the metatable from userdata objects that have been closed
> explicitly instead of storing NULL and checking.

almost as simple, and with nicer messages, would be to swap it with a 
generic 'object closed' metadata.

but either of those approaches would fail if the Lua side has another 
reference to an object method.  In any case, the first thing the method has 
to do is to check the object's type (or 'class'); and that should fail for a 
closed object

-- 
Javier

Attachment: signature.asc
Description: This is a digitally signed message part.