[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: LuaJIT: userdata and FFI cdata
- From: Mike Pall <mikelu-1101@...>
- Date: Sun, 23 Jan 2011 21:50:51 +0100
Florian Weimer wrote:
> However, it seems that there is no way to create a userdata object
> which is not zero-sized. Am I missing something?
Sure, I could expose a function to create arbitrary userdata
objects from Lua code. Previously the userdata payload was
inaccessible to Lua code, so this was a bit pointless. The initial
motivation for the automatic userdata -> void * conversion was to
support existing code.
I realize userdata is the only way to integrate cdata into the
current GC. However I'm not so sure that mixing userdata and cdata
is the way to go forward. But __gc for cdata will have to wait for
LuaJIT 2.1. And user-defined GC object traversal may be difficult
to implement efficiently. Hmm ...