diff --git a/doc/ext_ffi_api.html b/doc/ext_ffi_api.html index 5bd4b80c..2b6d1d86 100644 --- a/doc/ext_ffi_api.html +++ b/doc/ext_ffi_api.html @@ -238,6 +238,31 @@ This functions is mainly useful to override the pointer compatibility checks or to convert pointers to addresses or vice versa.

+

ctype = ffi.metatype(ct, metatable)

+

+Creates a ctype object for the given ct and associates it with +a metatable. Only struct/union types, complex numbers +and vectors are allowed. Other types may be wrapped in a +struct, if needed. +

+

+The association with a metatable is permanent and cannot be changed +afterwards. Neither the contents of the metatable nor the +contents of an __index table (if any) may be modified +afterwards. The associated metatable automatically applies to all uses +of this type, no matter how the objects are created or where they +originate from. Note that pre-defined operations on types have +precedence (e.g. declared field names cannot be overriden). +

+

+All standard Lua metamethods are implemented. These are called directly, +without shortcuts and on any mix of types. For binary operations, the +left operand is checked first for a valid ctype metamethod. The +__gc metamethod only applies to struct/union +types and performs an implicit ffi.gc() +call during creation of an instance. +

+

cdata = ffi.gc(cdata, finalizer)

Associates a finalizer with a pointer or aggregate cdata object. The diff --git a/doc/ext_ffi_semantics.html b/doc/ext_ffi_semantics.html index f9a118a0..d9aa27c8 100644 --- a/doc/ext_ffi_semantics.html +++ b/doc/ext_ffi_semantics.html @@ -582,6 +582,10 @@ Reference types are dereferenced before performing each of the operations below — the operation is applied to the C type pointed to by the reference.

+

+The pre-defined operations are always tried first before deferring to a +metamethod for a ctype (if defined). +

Indexing a cdata object