[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Userdata and luaL_ref
- From: Marc Lepage <mlepage@...>
- Date: Thu, 14 Feb 2013 17:19:57 -0500
I read a bit more about it again, I think you're right. So that part's as I wish.
Another thing I am thinking of doing, is being able to return to Lua a reference to the same type of userdata that *isn't* under Lua's management. Now, I could just return a light userdata with its address, but it would lack the metatable with all the metamethods. I guess I can't return a full userdata, because Lua would want to allocate (and later deallocate) that memory but it doesn't belong to Lua. So, is the best thing to do in this case, to return a table, with a metatable set, and values (including a light userdata), such that all accesses and methods just go to the light userdata?