diff options
Diffstat (limited to 'doc/ext_ffi_api.html')
-rw-r--r-- | doc/ext_ffi_api.html | 25 |
1 files changed, 25 insertions, 0 deletions
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 | |||
238 | checks or to convert pointers to addresses or vice versa. | 238 | checks or to convert pointers to addresses or vice versa. |
239 | </p> | 239 | </p> |
240 | 240 | ||
241 | <h3 id="ffi_metatype"><tt>ctype = ffi.metatype(ct, metatable)</tt></h3> | ||
242 | <p> | ||
243 | Creates a ctype object for the given <tt>ct</tt> and associates it with | ||
244 | a metatable. Only <tt>struct</tt>/<tt>union</tt> types, complex numbers | ||
245 | and vectors are allowed. Other types may be wrapped in a | ||
246 | <tt>struct</tt>, if needed. | ||
247 | </p> | ||
248 | <p> | ||
249 | The association with a metatable is permanent and cannot be changed | ||
250 | afterwards. Neither the contents of the <tt>metatable</tt> nor the | ||
251 | contents of an <tt>__index</tt> table (if any) may be modified | ||
252 | afterwards. The associated metatable automatically applies to all uses | ||
253 | of this type, no matter how the objects are created or where they | ||
254 | originate from. Note that pre-defined operations on types have | ||
255 | precedence (e.g. declared field names cannot be overriden). | ||
256 | </p> | ||
257 | <p> | ||
258 | All standard Lua metamethods are implemented. These are called directly, | ||
259 | without shortcuts and on any mix of types. For binary operations, the | ||
260 | left operand is checked first for a valid ctype metamethod. The | ||
261 | <tt>__gc</tt> metamethod only applies to <tt>struct</tt>/<tt>union</tt> | ||
262 | types and performs an implicit <a href="#ffi_gc"><tt>ffi.gc()</tt></a> | ||
263 | call during creation of an instance. | ||
264 | </p> | ||
265 | |||
241 | <h3 id="ffi_gc"><tt>cdata = ffi.gc(cdata, finalizer)</tt></h3> | 266 | <h3 id="ffi_gc"><tt>cdata = ffi.gc(cdata, finalizer)</tt></h3> |
242 | <p> | 267 | <p> |
243 | Associates a finalizer with a pointer or aggregate cdata object. The | 268 | Associates a finalizer with a pointer or aggregate cdata object. The |