lua-users home
lua-l archive

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


Well, in my defense, I already have read and re-read that chapter, both in the white book and the blue book. And I still did not get the subtle issue that lua_newuserdata() has to be left on the stack for return by the Cfunction. That is the missing detail. Instead I was returning its value (the pointer it allocates). Obviously you know a heck of a lot more about userdata than I do, so I don't know if you can appreciate the subtle difference when the person at the other end (me) has been going round and round for a couple of days. That little nugget of information you gave was the key I was missing. So tanks---I really do appreciate your help.

Michael

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


On Aug 16, 2009, at 4:57 PM, Michael Newberry wrote:

It is not true that anyone has told me explicitly to return full userdata using lua_newuserdata().

Well, in their defense, Sam and David (and maybe others in this thread) directed you to
http://www.lua.org/pil/28.1.html
which is all about lua_newuserdata().

It seemed to me you needed a whack with the keisaku. I'm glad you're on the right track now.

e