[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Specifying a different userdata size for gc purposes?
- From: "Peter Cawley" <lua@...>
- Date: Wed, 7 May 2008 17:51:31 +0100
Using something like: (the 2nd message in the above linked thread)
#include <new>
T* pClass = new ((T*)lua_newuserdata(L, sizeof(T))) T();
Probably won't help much when T is a class like:
class image_t {
byte* data;
int width, height, bpp;
...
};
The first method is probably more useful, provided that you keep the
GC's count up to date. The second method is useful in the general case
though.
2008/5/7 Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br>:
> > What I'm wondering is if there's any way of telling the lua garbage
> > collector that this userdata is actually occupying more than 4 bytes?
>
> Currently, not. But see http://lua-users.org/lists/lua-l/2007-06/msg00088.html
> and the next message in that thread for workarounds.
>