[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: rename LUA_RIDX_CPCALL to LUA_RIDX_CCALL? (5.2.0-work2)
- From: Drake Wilson <drake@...>
- Date: Sun, 9 May 2010 15:30:30 -0500
Quoth Florian Weimer <fw@deneb.enyo.de>, on 2010-05-09 18:55:19 +0200:
> I haven't tried this for real yet, but I plan to use a custom userdata
> with a __gc meta-method which invokes an embedded clean-up callback.
>
> Your example would then become:
>
> char const *const str = some_library_get_string();
> clair_push_cleanup(L, some_library_free_string, str);
Are you doing or planning to do something like using lua_cpcall,
shoving the extra userdata into the registry, and then stashing the
integer key for it somewhere? I assume you're handling the case where
lua_newuserdata fails. (Unless you mean you're just using a
preallocated userdata, in which case I don't know how you intend to
get __gc to be called at a suitable time.)
---> Drake Wilson