[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: Florian Weimer <fw@...>
- Date: Mon, 10 May 2010 19:16:25 +0200
* Drake Wilson:
> 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?
Oops, I guess it has to be implemented like this:
clair_push_cleanup(L);
char const *const str = some_library_get_string();
clair_set_cleanup(L, some_library_free_string, str);