lua-users home
lua-l archive

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

Jerome Vuarand wrote:

> Maybe that would be clearer with "Tables and full userdata have
> individual metatables".
> [1]

I think the behavior of userdata and lightuserdata differ enough that
their names should differ more. From an API perspective there's no
relationship between the types. Perhaps 'lightuserdata' could become
'handle', 'pointer', or 'voiddata'. Not that it matters much from the
Lua side, but one of the benefits would be that type() could return
something different for each. And the differing behavior of metatables
would be easier to explain.

Each time I have begun a project using lightuserdata, I eventually
switched to full userdata. I found the automatic management of an
object's lifetime outweighed the small time+space penalty for creation
of a full userdata. I suppose we cannot remove lightuserdata completely. :)


Innovative Concepts, Inc. 703-893-2007 x220