lua-users home
lua-l archive

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


Hi Thomas

On 11/08/09 15:27, Thomas Harning Jr. wrote:
Pointer's wouldn't work either (if I have that right)... assuming
you're pushing them as lightuserdata, my guess is that they behave
just like strings and numbers would, since they are a 'primitive'
type.  Also... the GC has no clue that a lightuserdata is equivalent
to a given userdata, table, function when iterating for cleanup, so
the GC wouldn't even be able to mark the two items as the same....
now.. that's assuming weak-keyed...
Sorry, bit of brain-fade. I meant weak-valued table (light ud pointer as key, UD as value).
As for weak-valued, then both lightuserdata and luaL_ref and the like
would work correctly (I think) .. just that there'd be holes showing
up over time.  If the holes can be re-filled by new data and
re-returned through luaL_ref ... I don't know.... implementation
defined.
Hmm...quick look in PiL doesn't add anything here. Not too sure what happens if you try and unref something that's already been removed by the GC....

Lawrie