[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: lua-5.0: userdata confusion
- From: Andrzej Borsuk <andrzej.borsuk@...>
- Date: Thu, 14 Nov 2002 09:04:39 +0100
Użytkownik Luiz Henrique de Figueiredo napisał:
> * lua_newuserdata() is not what I need, because I already have
> allocated memory...
If you need uniqueness,
then create a weak table indexed by your C pointers with values equal
corresponding userdata and only call lua_newuserdata or lua_boxpointer
pointer is not in the table. Note, a WEAK table is needed, otherwise
will never be GC'd.
Thanks, I'll try this... :-)
I did not expect that I will ever need to use weak references..
But.. I have one more question.
(I have tried to find answer in archives but without success)
Lua-4 had simple API with two functions newuserdata and pushusertag,
lua-5 have now only newuserdata. Why this? In my (maybe stupid) opinion
it does not conform to KISS rule. This implementation is limited only to
using malloced memory (no mmap, no shared memory, etc).
Im just courious...
\/>) Proszę wysyłać na moje podstawowe konto