lua-users home
lua-l archive

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


  I cannot find a formal method to determine the size of a full userdata
memory block.  I have found by looking at the lua source that I can cast the
value returned by lua_touserdata to an int pointer, subtract one from it,
and dereference it to get the size.  Is there a better way?

void *pData=lua_touserdata(L);
int nSize=*(((int *)pData)-1);

  Dan East