summaryrefslogtreecommitdiff
path: root/doc/ext_ffi_semantics.html
diff options
context:
space:
mode:
authorMike Pall <mike>2012-06-20 18:24:49 +0200
committerMike Pall <mike>2012-06-20 18:28:25 +0200
commit8b71ab108053c12bc2de9c1de0f786387a2b75e5 (patch)
tree98be8d9138d3cb13dac67f5f7621b0bf09bb0fc7 /doc/ext_ffi_semantics.html
parente9e45313e737579bc6db4f74942bcd66e95532c1 (diff)
downloadluajit-8b71ab108053c12bc2de9c1de0f786387a2b75e5.tar.gz
luajit-8b71ab108053c12bc2de9c1de0f786387a2b75e5.tar.bz2
luajit-8b71ab108053c12bc2de9c1de0f786387a2b75e5.zip
FFI: Check for __new metamethod when calling a constructor.
Diffstat (limited to 'doc/ext_ffi_semantics.html')
-rw-r--r--doc/ext_ffi_semantics.html12
1 files changed, 9 insertions, 3 deletions
diff --git a/doc/ext_ffi_semantics.html b/doc/ext_ffi_semantics.html
index 4b498fbe..d0613aed 100644
--- a/doc/ext_ffi_semantics.html
+++ b/doc/ext_ffi_semantics.html
@@ -599,8 +599,9 @@ C&nbsp;type pointed to by the reference.
599</p> 599</p>
600<p> 600<p>
601The pre-defined operations are always tried first before deferring to a 601The pre-defined operations are always tried first before deferring to a
602metamethod or index table (if any) for the corresponding ctype. An error 602metamethod or index table (if any) for the corresponding ctype (except
603is raised if the metamethod lookup or index table lookup fails. 603for <tt>__new</tt>). An error is raised if the metamethod lookup or
604index table lookup fails.
604</p> 605</p>
605 606
606<h3 id="cdata_array">Indexing a cdata object</h3> 607<h3 id="cdata_array">Indexing a cdata object</h3>
@@ -669,7 +670,12 @@ to <tt>foo.c</tt>.
669<ul> 670<ul>
670 671
671<li><b>Constructor</b>: a ctype object can be called and used as a 672<li><b>Constructor</b>: a ctype object can be called and used as a
672<a href="ext_ffi_api.html#ffi_new">constructor</a>.</li> 673<a href="ext_ffi_api.html#ffi_new">constructor</a>. This is equivalent
674to <tt>ffi.new(ct, ...)</tt>, unless a <tt>__new</tt> metamethod is
675defined. The <tt>__new</tt> metamethod is called with the ctype object
676plus any other arguments passed to the contructor. Note that you have to
677use <tt>ffi.new</tt> inside of it, since calling <tt>ct(...)</tt> would
678cause infinite recursion.</li>
673 679
674<li><b>C&nbsp;function call</b>: a cdata function or cdata function 680<li><b>C&nbsp;function call</b>: a cdata function or cdata function
675pointer can be called. The passed arguments are 681pointer can be called. The passed arguments are