lua-users home
lua-l archive

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

* Drake Wilson:

> Quoth Florian Weimer <>, 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:

     char const *const str = some_library_get_string();
     clair_set_cleanup(L, some_library_free_string, str);