|
On 5 Oct 2006, at 16:00, Doug Currie wrote:
Thursday, October 5, 2006, 6:18:43 AM, David Jones wrote:lua_tostring _has_ to modify the stack argument in order to keep the GC happy.Well, it _could_ create a global weak reference to the string instead.
No, because without a strong reference to the string the GC would be at liberty to free the string and thereby invalidate the pointer that you just got back from lua_tostring in the C world.
To put it another way, how does the GC know when it can collect the string returned by lua_tostring?
drj