lua-users home
lua-l archive

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


* Mike Pall:

> I hope the docs clear up many of your questions. If not, then
> please ask here. Feedback welcome!

I think it could be useful if you could create a cdata/userdata
combination.  This would allow access to the blob in a userdata as a C
structure, and you could still provide an object-specific metatable.

I think this is surprising (to a C++ programmer at least):

| Objects which are passed as an argument to an external C function
| are kept alive until the call returns.

I think the lifetime should extend to full expression, that is, beyond
the call.  The reason is that a function might return a pointer that
is passed in, such as:

  char *check_string(char *);

If this is called as

  do_something(check_string(ffi.new(...)))

then the returned pointer will not keep the original pointer live.