Re: Sequence of bytes - userdata or string?
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Sequence of bytes - userdata or string?
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Wed, 4 Jan 2012 15:55:59 -0200
If you create the byte data in the same block as the object, with
int len = luaL_checkinteger(L, 1);
TByteList *obj = (TByteList*) lua_newuserdata(L, sizeof(TByteList)+len);
obj->len = len;
obj->data = ((char *) obj)+sizeof(TByteList);
then you don't need a gc method.