[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Userdata and luaL_ref
- From: Kevin Martin <kev82@...>
- Date: Thu, 14 Feb 2013 22:57:54 +0000
On 14 Feb 2013, at 22:19, Marc Lepage wrote:
> 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?
I don't know if it's best, but it sounds like it would work. Also lua_touserdata will return the pointer regardless of whether the userdata is full or light, so you should be able to use exactly the same code regardless of who owns the userdata, in both cases, create the table, set the metatable, and set the userdata as an element of the table.