lua-users home
lua-l archive

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

> In my experience: numbers, strings, and boolean values aren't eligible
> for collection in this manner:
> [...]
> I've never looked into the implementation reasons for this, but I
> suspect there's a fairly good reason =).

You will not find the reason in the implementation, quite the opposite.
See PiL Chapter 17:

  Notice that only objects can be collected from a weak table. Values,
  such as numbers and booleans, are not collectible. [...]

  Strings present a subtlety here: Although strings are collectible,
  from an implementation point of view, they are not like other
  collectible objects. [...]

-- Roberto