lua-users home
lua-l archive

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


No, I returned both lightuserdata and the metatable containing the GC method. I also tried returning the pointer to the userdata using lua_pushlightuserdata and that made no difference. Remember I am returning two values, and I am assigning the second value to a table element back in the lua code. The two return values are stored in a table which I has setup as a class.

Michael

----- Original Message ----- From: "Doug Currie" <doug.currie@gmail.com>
To: "Lua list" <lua@bazar2.conectiva.com.br>
Sent: Sunday, August 16, 2009 11:47 AM
Subject: Re: how does GC work with complex expressions using metamethods?


On Aug 16, 2009, at 2:22 PM, Michael Newberry wrote:

This is what I was talking about when I asked about the carbage collector "What defines being "used" by lua?"

It is considered used if Lua can find it by following references (but NOT lightuserdata pointers) from global variables or the Lua stack.

For some reason, lua believes it is time for this userdata to be deleted. Why?

Probably because you returned lightuserdata from CreadeData() instead of userdata?

Where is the userdata being returned and/or stored?

e