[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: what replacement for (obsolete) lua_ref in 5.0 ?
- From: Benoit Germain <bgermain@...>
- Date: Mon, 10 Feb 2003 12:45:01 +0100
Hello,
I way just wondering: the current implementation makes use of the numeric
indexes in the registry table. But lua_ref() and related stuff is here for
compatibility only (as mentionned in lua.h), meaning that it should not
remain, right ?
Then, since being able to tell lua about objects that the host does not want
to see collected is quite useful, what alternative is proposed, apart from
letting the host implement its own referencing mechanism, in a way much
similar to what already exists (therefore why is this presented as
compatibility-only, and no longer documented) ?
Another related comment: this table thing is fine, but in some cases a much
faster and memory-efficient solution could be made available. The case I am
thinking about is when some host entity maintains an equivalent lua object
with matching life span. The host is responsible for the entity, and whether
the lua state has valid references to the lua associated object, it must not
be collected. The question of how many references are made to a given lua
object is not relevant, so having multiple references to a same object is
not necessary.
I had quick look at the core and witnessed the wonderful luaS_fix macro,
that flags a few reserved strings as non collectable. What are the potential
problems of exposing an API call to do this from the host for any
collactable lua object ?
Cheers,
Benoit.