[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: How reliable is lua_topointer() ?
- From: Jerome Vuarand <jerome.vuarand@...>
- Date: Wed, 12 Aug 2009 18:04:13 +0200
2009/8/12 Gé Weijers <ge@weijers.org>:
> One warning: if the C library keeps the pointer for a long time a new object
> can end up at the same location as the old one, and it can get really hard
> to figure out what's going on. A 'ref' value is safer in that respect.
I'm not advocating the use of lua_topointer at all, but in that
respect the use of a 'ref' is not safer, it's just as safe in a table
with strong references, and just as unsafe in a table with weak
references. If the 'ref' is weak, the object can be collected, and
another object receive the same integer id in a subsequent call to
luaL_ref.